From 2dc37f411e8947d3c20cd93d1fa1937edc239499 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 27 Mar 2024 14:14:27 -0700 Subject: feat(task): Task description in the form of comments (#23101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #22786. TLDR; ```jsonc { "tasks": { // Some comment // // describing what the task does "dev": "deno run -A --watch main.ts" } } ``` ```bash deno task ``` ![Screenshot 2024-03-27 at 1 43 49 PM](https://github.com/denoland/deno/assets/17734409/7a14da8c-8e63-45ba-9bfb-590d250b56a9) --- tests/specs/task/doc_comments_incorrect/__test__.jsonc | 6 ++++++ tests/specs/task/doc_comments_incorrect/deno.jsonc | 7 +++++++ tests/specs/task/doc_comments_incorrect/task.out | 6 ++++++ tests/specs/task/doc_comments_no_args/__test__.jsonc | 6 ++++++ tests/specs/task/doc_comments_no_args/deno.jsonc | 12 ++++++++++++ tests/specs/task/doc_comments_no_args/task.out | 9 +++++++++ 6 files changed, 46 insertions(+) create mode 100644 tests/specs/task/doc_comments_incorrect/__test__.jsonc create mode 100644 tests/specs/task/doc_comments_incorrect/deno.jsonc create mode 100644 tests/specs/task/doc_comments_incorrect/task.out create mode 100644 tests/specs/task/doc_comments_no_args/__test__.jsonc create mode 100644 tests/specs/task/doc_comments_no_args/deno.jsonc create mode 100644 tests/specs/task/doc_comments_no_args/task.out (limited to 'tests') diff --git a/tests/specs/task/doc_comments_incorrect/__test__.jsonc b/tests/specs/task/doc_comments_incorrect/__test__.jsonc new file mode 100644 index 000000000..e564690e6 --- /dev/null +++ b/tests/specs/task/doc_comments_incorrect/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "args": "task doesntexist", + "envs": { "NO_COLOR": "1" }, + "output": "task.out", + "exitCode": 1 +} diff --git a/tests/specs/task/doc_comments_incorrect/deno.jsonc b/tests/specs/task/doc_comments_incorrect/deno.jsonc new file mode 100644 index 000000000..6b27f2850 --- /dev/null +++ b/tests/specs/task/doc_comments_incorrect/deno.jsonc @@ -0,0 +1,7 @@ +{ + "tasks": { + // some docs + // on what this does + "lint": "deno lint" + } +} diff --git a/tests/specs/task/doc_comments_incorrect/task.out b/tests/specs/task/doc_comments_incorrect/task.out new file mode 100644 index 000000000..9d81c1768 --- /dev/null +++ b/tests/specs/task/doc_comments_incorrect/task.out @@ -0,0 +1,6 @@ +Task not found: doesntexist +Available tasks: +- lint + // some docs + // on what this does + deno lint diff --git a/tests/specs/task/doc_comments_no_args/__test__.jsonc b/tests/specs/task/doc_comments_no_args/__test__.jsonc new file mode 100644 index 000000000..2f9db088a --- /dev/null +++ b/tests/specs/task/doc_comments_no_args/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "args": "task", + "envs": { "NO_COLOR": "1" }, + "output": "task.out", + "exitCode": 1 +} diff --git a/tests/specs/task/doc_comments_no_args/deno.jsonc b/tests/specs/task/doc_comments_no_args/deno.jsonc new file mode 100644 index 000000000..4b6d690c8 --- /dev/null +++ b/tests/specs/task/doc_comments_no_args/deno.jsonc @@ -0,0 +1,12 @@ +{ + "tasks": { + // this task has documentation + // + // in the form of comments + "lint": "deno lint", + /* + * block comments are fine too + */ + "fmt": "deno fmt" + } +} diff --git a/tests/specs/task/doc_comments_no_args/task.out b/tests/specs/task/doc_comments_no_args/task.out new file mode 100644 index 000000000..635e36090 --- /dev/null +++ b/tests/specs/task/doc_comments_no_args/task.out @@ -0,0 +1,9 @@ +Available tasks: +- lint + // this task has documentation + // + // in the form of comments + deno lint +- fmt + // block comments are fine too + deno fmt -- cgit v1.2.3