#compdef task # Listing commands from Taskfile.yml function __list() { local -a scripts if [ -f Taskfile.yml ]; then scripts=($(task -l | sed '1d' | sed 's/^* //' | sed 's/\:\s.*//' | sed 's/\(\w\):\(\w\)/\1\\\:\2/')) _describe 'script' scripts fi } _arguments \ '(-d --dir)'{-d,--dir}': :_files' \ '(--dry)'--dry \ '(-f --force)'{-f,--force} \ '(-i --init)'{-i,--init} \ '(-l --list)'{-l,--list} \ '(-s --silent)'{-s,--silent} \ '(--status)'--status \ '(-v --verbose)'{-v,--verbose} \ '(--version)'--version \ '(-w --watch)'{-w,--watch} \ '(- *)'{-h,--help} \ '*: :__list' \