API-CLI
view release on metacpan or search on metacpan
examples/bash/githubcl.bash view on Meta::CPAN
#!bash
# http://stackoverflow.com/questions/7267185/bash-autocompletion-add-description-for-possible-completions
_githubcl() {
COMPREPLY=()
local program=githubcl
local cur=${COMP_WORDS[$COMP_CWORD]}
# echo "COMP_CWORD:$COMP_CWORD cur:$cur" >>/tmp/comp
declare -a FLAGS
declare -a OPTIONS
declare -a MYWORDS
local INDEX=`expr $COMP_CWORD - 1`
MYWORDS=("${COMP_WORDS[@]:1:$COMP_CWORD}")
FLAGS=('--debug' 'debug' '-d' 'debug' '--verbose' 'verbose' '-v' 'verbose' '--help' 'Show command help' '-h' 'Show command help')
OPTIONS=('--data-file' 'File with data for POST/PUT/PATCH/DELETE requests')
__githubcl_handle_options_flags
case $INDEX in
0)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' 'DELETE'$'\t''DELETE call'$'\n''GET'$'\t''GET call'$'\n''PATCH'$'\t''PATCH call'$'\n''POST'$'\t''POST call'$'\n''PUT'$'\t''PUT call'$'\n''help'$'\t''Show command help'
;;
*)
# subcmds
case ${MYWORDS[0]} in
DELETE)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
1)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' '/gists/:id'$'\t''Delete a gist.'$'\n''/gists/:id/comments/:commentId'$'\t''Delete a comment.'$'\n''/gists/:id/star'$'\t''Unstar a gist.'$'\n''/notifications/threads/:id/subscription'$'\t''Delete a Threa...
;;
*)
# subcmds
case ${MYWORDS[1]} in
/gists/:id)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/gists/:id/comments/:commentId)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
;;
3)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/gists/:id/star)
FLAGS+=()
examples/bash/githubcl.bash view on Meta::CPAN
3)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/repos/:owner/:repo/statuses/:ref)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
;;
3)
__comp_current_options || return
;;
4)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/user/emails)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/user/keys)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/user/repos)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
esac
;;
esac
;;
PUT)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
1)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' '/gists/:id/star'$'\t''Star a gist.'$'\n''/notifications'$'\t''Mark as read.'$'\n''/notifications/threads/:id/subscription'$'\t''Set a Thread Subscription.'$'\n''/orgs/:org/public_members/:username'$'\t'...
;;
*)
# subcmds
case ${MYWORDS[1]} in
/gists/:id/star)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/notifications)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/notifications/threads/:id/subscription)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
;;
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
esac
;;
esac
;;
/orgs/:org/public_members/:username)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
examples/bash/githubcl.bash view on Meta::CPAN
generate)
FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
__githubcl_handle_options_flags
case $INDEX in
*)
__comp_current_options true || return # after parameters
case ${MYWORDS[$INDEX-1]} in
--data-file)
;;
--name)
;;
esac
;;
esac
;;
esac
;;
esac
;;
pod)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' 'generate'$'\t''Generate self pod'
;;
*)
# subcmds
case ${MYWORDS[2]} in
generate)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
esac
;;
esac
;;
esac
;;
esac
;;
help)
FLAGS+=('--all' '')
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
1)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' 'DELETE'$'\n''GET'$'\n''PATCH'$'\n''POST'$'\n''PUT'
;;
*)
# subcmds
case ${MYWORDS[1]} in
DELETE)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' '/gists/:id'$'\n''/gists/:id/comments/:commentId'$'\n''/gists/:id/star'$'\n''/notifications/threads/:id/subscription'$'\n''/orgs/:org/members/:username'$'\n''/orgs/:org/public_members/:username'$'\n'...
;;
*)
# subcmds
case ${MYWORDS[2]} in
/gists/:id)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/gists/:id/comments/:commentId)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/gists/:id/star)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/notifications/threads/:id/subscription)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/orgs/:org/members/:username)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/orgs/:org/public_members/:username)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
examples/bash/githubcl.bash view on Meta::CPAN
;;
/repos/:owner/:repo/merges)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/milestones)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/pulls)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/pulls/:number/comments)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/releases)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/statuses/:ref)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/user/emails)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/user/keys)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/user/repos)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
esac
;;
esac
;;
PUT)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
case $INDEX in
2)
__comp_current_options || return
__githubcl_dynamic_comp 'commands' '/gists/:id/star'$'\n''/notifications'$'\n''/notifications/threads/:id/subscription'$'\n''/orgs/:org/public_members/:username'$'\n''/repos/:owner/:repo/collaborators/:user'$'\n''/repos/:owner/:repo/c...
;;
*)
# subcmds
case ${MYWORDS[2]} in
/gists/:id/star)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/notifications)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/notifications/threads/:id/subscription)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/orgs/:org/public_members/:username)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/collaborators/:user)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/contents/:path)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/issues/:number/labels)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
;;
/repos/:owner/:repo/notifications)
FLAGS+=()
OPTIONS+=()
__githubcl_handle_options_flags
__comp_current_options true || return # no subcmds, no params/opts
( run in 0.622 second using v1.01-cache-2.11-cpan-39bf76dae61 )