Merge branch 'internal-tasks' of https://github.com/pd93/task into pd93-internal-tasks

This commit is contained in:
Andrey Nering
2022-09-17 12:59:19 -03:00
13 changed files with 190 additions and 7 deletions

View File

@@ -194,6 +194,21 @@ tasks:
- echo "This command can still be successfully executed if ./tests/Taskfile.yml does not exist"
```
### Internal includes
Includes marked as internal will set all the tasks of the included file to be
internal as well (See the [Internal Tasks](#internal-tasks) section below). This is useful when including utility tasks that are not
intended to be used directly by the user.
```yaml
version: '3'
includes:
tests:
taskfile: ./taskfiles/Utils.yml
internal: true
```
### Vars of included Taskfiles
You can also specify variables when including a Taskfile. This may be useful
@@ -223,6 +238,30 @@ use the [default function](https://go-task.github.io/slim-sprig/defaults.html):
:::
## Internal Tasks
Internal tasks are tasks that cannot be called directly by the user. They will
not appear in the output when running `task --list|--list-all`. Other tasks may
call internal tasks in the usual way. This is useful for creating reusable,
function-like tasks that have no useful purpose on the command line.
```yaml
version: '3'
tasks:
build-image-1:
cmds:
- task: build-image
vars:
DOCKER_IMAGE: image-1
build-image:
internal: true
cmds:
- docker build -t {{.DOCKER_IMAGE}} .
```
## Task directory
By default, tasks will be executed in the directory where the Taskfile is