Skip to content

Instantly share code, notes, and snippets.

@syohex
Last active December 16, 2015 04:29
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 syohex/5377595 to your computer and use it in GitHub Desktop.
Save syohex/5377595 to your computer and use it in GitHub Desktop.
zsh completion funtion for Minilla
#compdef minil
typeset -A opt_args
local context state line
local -a _minil_subcommands
_minil_subcommands=(
'new:Create a new dist'
'build:Build distribution'
'test:Run test cases'
'dist:Make dist tarball'
'install:Install distribution'
'release:Release distribution to CPAN'
'migrate:Migrate not Minillaized module'
)
_arguments '*:: :->subcmd'
if [[ "$state" == "subcmd" ]];then
if (( CURRENT == 1)); then
_describe -t commands "minil command" _minil_subcommands -V1
return
else
local opts curcontext
case "$words[1]" in
new)
opts=(
'(-p|--profile)'{-p,--profile}'[Minilla profile]: :(XS)'
)
;;
install)
opts=('--no-test[Do not run test]')
;;
release)
opts=(
'--no-test[Do not run test]'
'--trial[Trial release]'
'--dry-test[Dry run mode]'
)
;;
test)
opts=(
'--release[enable the RELEASE_TESTING env variable]'
'--automated[enable the AUTOMATED_TESTING env variable]'
'--author[enable the AUTHOR_TESTING env variable]'
'--all[enable the All env variables]'
)
;;
*)
opts=()
;;
esac
_arguments -s : "$opts[@]" '*::Files:_files'
fi
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment