Skip to content

Instantly share code, notes, and snippets.

@hamaco
Last active August 29, 2015 14:16
Show Gist options
  • Save hamaco/636fc654f8623f96871d to your computer and use it in GitHub Desktop.
Save hamaco/636fc654f8623f96871d to your computer and use it in GitHub Desktop.
ShouldBee コマンド補完ファイル
#compdef shouldbee
function _shouldbee () {
local context curcontext=$curcontext state line
declare -A opt_args
local ret=1
_arguments -C \
'(-h --help)'{-h,--help}'[show help]' \
'(-v --version)'{-v,--version}'[print the version]' \
'(--debug)--debug[debug mode]' \
'(--credit)--credit[show credits this program]' \
'1: :__shouldbee_commands' \
'*:: :->args' \
&& ret=0
case $state in
(args)
case $words[1] in
(init)
_arguments -C \
'(-h --help)'{-h,--help}'[show help]' \
'(-f --file --filename)'{-f,--file,--filename}'[Create Shouldbeefile as given file filename.]' \
'(-)*:: :->null_state' \
&& ret=0
;;
(run)
_arguments -C \
'(-h --help)'{-h,--help}'[show help]' \
'(-f --file --shouldbeefile)'{-f,--file,--shouldbeefile}'[Create Shouldbeefile as given file filename.]' \
'1: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
__shouldbee_commands () {
local -a _c
_c=(
'init:Initializes a new testing by creating a Shouldbeefile'
'run:Runs the testing'
)
_describe -t commands Commands _c
}
_shouldbee "$@"
# vim: ft=zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment