From 7160f5f9628a04d42e4ac9ae77c08fa85b52e66f Mon Sep 17 00:00:00 2001 From: Roy Sommer Date: Sun, 16 May 2021 19:58:38 +0300 Subject: Allow Declaring Tasks with Descriptions (#35) adds the ability to declare tasks explicitly, including command and description text --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 61a1f61..6ed19ef 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ In your `pyproject.toml` file, add a new section called `[tool.taskipy.tasks]`. The section is a key-value map, from the names of the task to the actual command that should be run in the shell. -Example: +There are two ways to define tasks. The easy way is to simply write the command down as a string: __pyproject.toml__ ```toml @@ -56,6 +56,17 @@ test = "python -m unittest tests/test_*.py" lint = "pylint tests taskipy" ``` +Alternatively, you can define tasks more explicitly by declaring both the command and a helpful description using an inline table: + +__pyproject.toml__ +```toml +[tool.taskipy.tasks] +test = { cmd = "python -m unittest tests/test_*.py", help = "runs all unit tests" } +lint = { cmd = "pylint tests taskipy", help = "confirms code style using pylint" } +``` + +The explicit notation is more verbose, but provides better context to anyone who uses the task. + ### Running Tasks In order to run a task, run the following command in your terminal: ```bash @@ -69,6 +80,13 @@ test python -m unittest tests/test_*.py lint pylint tests taskipy ``` +If you declared your task explicitly, you will see the description of the task by the side of the task's name: +```bash +$ poetry run task --list +test runs all unit tests +lint confirms code style using pylint +``` + ### Passing Command Line Args to Tasks If you want to pass command line arguments to tasks (positional or named), simply append them to the end of the task command. -- cgit v1.2.3