Skip to content

Instantly share code, notes, and snippets.

@fschulze
Forked from esteele/_develop
Created August 23, 2012 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fschulze/3437687 to your computer and use it in GitHub Desktop.
Save fschulze/3437687 to your computer and use it in GitHub Desktop.
zsh completion for mr.developer
#compdef develop
if [[ "$words[1]" != "$_cache_develop_cmd" ]]; then
_cache_develop_cmd="$words[1]"
fi
_arguments -C \
'(-h --help)'{-h,--help}'[Show help]' \
'(-v --version)'{-v,--version}'[Print version]' \
'*::command:->command' \
&& return 0
case $state in
command)
if ((CURRENT == 1)); then
state=subcommands
else
state=packagename
fi
;;
esac
case $state in
subcommands)
cmds=($("$_cache_develop_cmd" help -z))
_describe -t commands 'develop commands' cmds
;;
packagename)
packagelist=($("$_cache_develop_cmd" help "$words[1]" -z))
_describe -t commands 'available packages' packagelist
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment