Prefix Matching (#2947)
WARNING
All experimental features are subject to breaking changes and/or removal at any time. We strongly recommend that you do not use these features in a production environment. They are intended for testing and feedback only.
INFO
To enable this experiment, set the environment variable: TASK_X_PREFIX_MATCHING=1 or configure it in .taskrc.yml:
experiments:
PREFIX_MATCHING: 1Check out our guide to enabling experiments for more information.
This experiment adds support for Shortest Unique Prefix Matching (segment-wise abbreviation matching) when running tasks.
In large Taskfiles with multi-level namespaces (for example, api:openapi:export), typing the full task name or manually defining short aliases for each task can be tedious.
How It Works
Unique Match: When an input prefix uniquely matches a task (or one of its aliases), Task will execute it immediately.
task a:o:ematchesapi:openapi:exporttask api:omatchesapi:openapi:export(if no otherapi:o*tasks exist)task bmatchesbuild(if no otherb*tasks exist)
Ambiguous Match: If the prefix matches multiple tasks, Task will halt execution and return a conflict error listing all candidate tasks:
texttask: Found multiple tasks (docker:build:production, docker:build:staging) that match "doc"Precedence: Direct task name matches, alias matches, and wildcard matches always take precedence over prefix matching.