You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/usage.mdx
+52-12Lines changed: 52 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -393,6 +393,8 @@ You can run `task foo` directly without the namespace.
393
393
You can also reference the task in other tasks without the namespace. So if you run `task greet` it will run `greet` and `foo` tasks and the output will be :
394
394
395
395
```text
396
+
Greet
397
+
Foo
396
398
```
397
399
398
400
If multiple tasks have the same name, an error will be thrown:
@@ -409,14 +411,14 @@ If multiple tasks have the same name, an error will be thrown:
409
411
version: '3'
410
412
includes:
411
413
lib:
412
-
taskfile: ./Included.yml
413
-
flatten: true
414
-
415
-
tasks:
416
-
greet:
417
-
cmds:
418
-
- echo "Greet"
419
-
- task: foo
414
+
taskfile: ./Included.yml
415
+
flatten: true
416
+
417
+
tasks:
418
+
greet:
419
+
cmds:
420
+
- echo "Greet"
421
+
- task: foo
420
422
```
421
423
422
424
@@ -427,9 +429,9 @@ If multiple tasks have the same name, an error will be thrown:
427
429
version: '3'
428
430
429
431
tasks:
430
-
greet:
431
-
cmds:
432
-
- echo "Foo"
432
+
greet:
433
+
cmds:
434
+
- echo "Foo"
433
435
```
434
436
435
437
@@ -438,12 +440,50 @@ If multiple tasks have the same name, an error will be thrown:
438
440
If you run `task -a` it will print:
439
441
```text
440
442
task: Found multiple tasks (greet) included by "lib"
441
-
442
443
```
443
444
445
+
If you the included Taskfile has a task with the same name as a task in the main Taskfile,
446
+
you may want to exclude it from the flattened tasks.
447
+
448
+
You can do this by using the [`excludes` option](#exclude-tasks-from-being-included).
449
+
450
+
### Exclude tasks from being included
451
+
452
+
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.
453
+
454
+
<Tabs defaultValue="1"
455
+
values={[
456
+
{label: 'Taskfile.yml', value: '1'},
457
+
{label: 'Included.yml', value: '2'}
458
+
]}>
459
+
460
+
<TabItem value="1">
461
+
```yaml
462
+
version: '3'
463
+
includes:
464
+
included:
465
+
taskfile: ./Included.yml
466
+
excludes: [foo]
467
+
```
468
+
469
+
470
+
</TabItem>
471
+
<TabItem value="2">
472
+
473
+
```yaml
474
+
version: '3'
475
+
476
+
tasks:
477
+
foo: echo "Foo"
478
+
bar: echo "Bar"
479
+
```
480
+
444
481
482
+
</TabItem></Tabs>
445
483
484
+
`task included:foo`will throw an error because the `foo` task is excluded but `task included:bar` will work and display `Bar`.
0 commit comments