diff options
| author | Roy Sommer <illBeRoy@users.noreply.github.com> | 2021-05-16 19:58:38 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-16 19:58:38 +0300 |
| commit | 7160f5f9628a04d42e4ac9ae77c08fa85b52e66f (patch) | |
| tree | c2ed82304c6a373b86be0e11568f33d9ce93dcdc /README.md | |
| parent | Release version 1.7.0 (diff) | |
| download | taskipy2-7160f5f9628a04d42e4ac9ae77c08fa85b52e66f.zip | |
Allow Declaring Tasks with Descriptions (#35)
adds the ability to declare tasks explicitly, including command and description text
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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. |