mirror of
https://github.com/go-task/task.git
synced 2026-08-29 10:08:27 +02:00
feat: support excluding task namespaces (#2959)
This commit is contained in:
@@ -412,8 +412,10 @@ You can do this by using the
|
||||
|
||||
### Exclude tasks from being included
|
||||
|
||||
You can exclude tasks from being included by using the `excludes` option. This
|
||||
option takes the list of tasks to be excluded from this include.
|
||||
You can exclude tasks or entire namespaces from being included by using the
|
||||
`excludes` option. This option takes the list of tasks or namespaces to be
|
||||
excluded from this include. Task names are matched exactly. To exclude a
|
||||
namespace, append `:*` to its name.
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -423,7 +425,7 @@ version: '3'
|
||||
includes:
|
||||
included:
|
||||
taskfile: ./Included.yml
|
||||
excludes: [foo]
|
||||
excludes: [foo, 'internal:*', 'debug:*']
|
||||
```
|
||||
|
||||
```yaml [Included.yml]
|
||||
@@ -432,11 +434,14 @@ version: '3'
|
||||
tasks:
|
||||
foo: echo "Foo"
|
||||
bar: echo "Bar"
|
||||
internal:setup: echo "Internal setup"
|
||||
debug:status: echo "Debug status"
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
`task included:foo` will throw an error because the `foo` task is excluded but
|
||||
`task included:foo`, `task included:internal:setup`, and
|
||||
`task included:debug:status` will throw errors because they are excluded, but
|
||||
`task included:bar` will work and display `Bar`.
|
||||
|
||||
It's compatible with the `flatten` option.
|
||||
|
||||
@@ -308,13 +308,14 @@ includes:
|
||||
### `excludes`
|
||||
|
||||
- **Type**: `[]string`
|
||||
- **Description**: Tasks to exclude from inclusion
|
||||
- **Description**: Task names or namespace patterns ending in `:*` to exclude
|
||||
from inclusion
|
||||
|
||||
```yaml
|
||||
includes:
|
||||
shared:
|
||||
taskfile: ./shared.yml
|
||||
excludes: [internal-setup, debug-only]
|
||||
excludes: [internal-setup, 'debug:*', 'experimental:*']
|
||||
```
|
||||
|
||||
### `vars`
|
||||
|
||||
@@ -746,7 +746,7 @@
|
||||
}
|
||||
},
|
||||
"excludes": {
|
||||
"description": "A list of tasks to be excluded from inclusion.",
|
||||
"description": "A list of task names or namespace patterns ending in `:*` to be excluded from inclusion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
||||
Reference in New Issue
Block a user