Skip to content

Commit

Permalink
Implemented base of completion
Browse files Browse the repository at this point in the history
  • Loading branch information
matken11235 committed Aug 10, 2018
1 parent a42072b commit 836b262
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/comp/poac.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

if ! command -v poac >/dev/null 2>&1; then
return
fi

__poac() {
local words=${COMP_WORDS}
local cword=${COMP_CWORD}
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}

case "${prev}" in
uninstall) COMPREPLY=$(ls ./deps) ;;
*) COMPREPLY=($__poac_commands) ;;
esac

return 0
}

# complete is a bash builtin, but recent versions of ZSH come with a function
# called bashcompinit that will create a complete in ZSH. If the user is in
# ZSH, load and run bashcompinit before calling the complete function.
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
autoload -U +X compinit && compinit
fi

complete -F __poac poac

__poac_commands='cache
doc
init
install
login
new
publish
root
run
search
uninstall
update'

0 comments on commit 836b262

Please sign in to comment.