4.3 KiB
4.3 KiB
layout
| layout |
|---|
| layouts/base.njk |
Usage
It is recommended to use simple shell alias to run the task file: alias task='./task'
Start with showing the available commands: task help
You should get an output like this:
task <command> [options]
commands:
| Command | Option | Description |
|----------------------|--------|--------------------------------------|
| all | | Run all tasks. |
| install | | Install build dependencies. |
| lint | | Lint code with prettier. |
...
You can now run a task command with task install.
It is also possible to run multiple commands without parameters: task install,lint
And if there is a command group run it with task all.
Completion
With the output of task help the task commands can be completed.
Completion for bash: /etc/bash_completion.d/task_completions
#!/usr/bin/env bash
_task_completions() {
local cur prev commands
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands=$(./task help | grep -A999 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$' | tr '\n' ' ')
if [[ ${COMP_CWORD} == 1 ]]; then
COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
elif [[ ${COMP_CWORD} == 2 ]]; then
COMPREPLY=( $(compgen -f -- "${cur}") )
else
COMPREPLY=()
fi
}
complete -F _task_completions task
complete -F _task_completions t
Completion for zsh: ~/.oh-my-zsh/completions/_task
#compdef task t
_arguments '1: :->tasks' '*: :_files'
case "$state"<