website/src/docs/reference/cli.md
Task has multiple ways of being configured. These methods are parsed, in sequence, in the following order with the highest priority last:
In this document, we will look at the last of the three options, command-line flags. All CLI commands override their configuration file and environment variable equivalents.
Task commands have the following syntax:
task [options] [tasks...] [-- CLI_ARGS...]
::: tip
If -- is given, all remaining arguments will be assigned to a special
CLI_ARGS variable.
:::
task [tasks...]Run one or more tasks defined in your Taskfile.
task build
task test lint
task deploy --force
task --listList all available tasks with their descriptions.
task --list
task -l
task --list-allList all tasks, including those without descriptions.
task --list-all
task -a
task --initCreate a new Taskfile.yml in the current directory.
task --init
task -i
::: tip
Combine --list or --list-all with --silent (-ls or -as for shortants)
to list only the task names in each line. Useful for scripting with grep or
similar.
:::
-h, --helpShow help information.
task --help
--versionShow Task version.
task --version
-v, --verboseEnable verbose mode for detailed output.
verboseTASK_VERBOSEtask build --verbose
-s, --silentDisable command echoing.
silentTASK_SILENTtask deploy --silent
--disable-fuzzyDisable fuzzy matching for task names. When enabled, Task will not suggest similar task names when you mistype a task name.
disable-fuzzyTASK_DISABLE_FUZZYtask buidl --disable-fuzzy
# Output: Task "buidl" does not exist
# (without "Did you mean 'build'?" suggestion)
-F, --failfastStop executing dependencies as soon as one of them fails.
failfastTASK_FAILFASTtask build --failfast
-f, --forceForce execution even when the task is up-to-date.
task build --force
-n, --dryCompile and print tasks without executing them.
TASK_DRYtask deploy --dry
-p, --parallelExecute multiple tasks in parallel.
task test lint --parallel
-C, --concurrency <number>Limit the number of concurrent tasks. Zero means unlimited.
concurrencyTASK_CONCURRENCYtask test --concurrency 4
-x, --exit-codePass through the exit code of failed commands.
task test --exit-code
-d, --dir <path>Set the directory where Task will run and look for Taskfiles.
task build --dir ./backend
-t, --taskfile <file>Specify a custom Taskfile path.
task build --taskfile ./custom/Taskfile.yml
-g, --globalRun the global Taskfile from $HOME/Taskfile.{yml,yaml}.
task backup --global
-o, --output <mode>Set output style. Available modes: interleaved, group, prefixed.
task test --output group
--output-group-begin <template>Message template to print before grouped output.
task test --output group --output-group-begin "::group::{{.TASK}}"
--output-group-end <template>Message template to print after grouped output.
task test --output group --output-group-end "::endgroup::"
--output-group-error-onlyOnly show command output on non-zero exit codes.
task test --output group --output-group-error-only
-c, --colorControl colored output. Enabled by default.
colorTASK_COLORtask build --color=false
# or use environment variable
NO_COLOR=1 task build
--statusCheck if tasks are up-to-date without running them.
task build --status
--summaryShow detailed information about a task.
task build --summary
--jsonOutput task information in JSON format (use with --list or --list-all).
task --list --json
--sort <mode>Change task listing order. Available modes:
default - Sorts tasks alphabetically by name, but ensures that root tasks
(tasks without a namespace) are listed before namespaced tasks.alphanumeric - Sort tasks alphabetically by name.none - No sorting. Uses the order as defined in the Taskfile.task --list --sort alphanumeric
-w, --watchWatch for file changes and re-run tasks automatically.
task build --watch
-I, --interval <duration>Set watch interval (default: 5s). Must be a valid
Go duration.
task build --watch --interval 1s
-y, --yesAutomatically answer "yes" to all prompts.
TASK_ASSUME_YEStask deploy --yes
--interactiveEnable interactive prompts for missing required variables. When a required variable is not provided, Task will prompt for input instead of failing.
Task automatically detects non-TTY environments (like CI pipelines) and skips
prompts. This flag can also be set in .taskrc.yml to enable prompts by
default.
TASK_INTERACTIVEtask deploy --interactive
Task uses specific exit codes to indicate different types of errors:
--init)::: info
When using -x/--exit-code, failed command exit codes are passed through
instead of the above codes.
:::
::: tip
The complete list of exit codes is available in the repository at
errors/errors.go.
:::
When using --json with --list or --list-all:
{
"tasks": [
{
"name": "build",
"task": "build",
"desc": "Build the application",
"summary": "Compiles the source code and generates binaries",
"up_to_date": false,
"location": {
"line": 12,
"column": 3,
"taskfile": "/path/to/Taskfile.yml"
}
}
],
"location": "/path/to/Taskfile.yml"
}