#compdef mix #autoload # Elixir mix zsh completion local -a _1st_arguments _1st_arguments=( "${(@f)$(mix help | egrep "^mix " | tail -n+2 | sed 's/^mix //;s/\s\+#\s/:/')}" '--help:Describe available tasks' '--version:Prints the Elixir version information' ) __task_list () { local expl declare -a tasks tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test) _wanted tasks expl 'help' compadd $tasks } local expl local curcontext="$curcontext" state line typeset -A opt_args _arguments -C \ ':command:->command' \ '*::options:->options' case $state in (command) _describe -t commands "mix subcommand" _1st_arguments return ;; (options) case $line[1] in (help) _arguments ':feature:__task_list' esac ;; esac