attempt bash completion, but it doesn't work
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
910d3070f3
commit
b129e1b1de
|
@ -0,0 +1,44 @@
|
|||
#/usr/bin/env bash
|
||||
|
||||
VIRTIGOCTL1="
|
||||
git
|
||||
uptime
|
||||
dc
|
||||
"
|
||||
|
||||
declare -A VIRTIGOCTL_COMP
|
||||
VIRTIGOCTL_COMP[git]="
|
||||
push
|
||||
log
|
||||
"
|
||||
VIRTIGOCTL_COMP[start]="foo.wit.com boo.wit.com"
|
||||
|
||||
_git_cc() { COMPREPLY=(-a -b); }
|
||||
_git_wit() { COMPREPLY=(dump-droplets start filename); }
|
||||
|
||||
# complete -F _wit_complete wit
|
||||
|
||||
_virtigoctl_complete()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
COMPREPLY=( $(compgen -W "$VIRTIGOCTL1" -- $cur) )
|
||||
elif [ $COMP_CWORD -eq 2 ]; then
|
||||
case "$prev" in
|
||||
"screen")
|
||||
COMPREPLY=( $(compgen -W "reattach" -- $cur) )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "${VIRTIGOCTL_COMP[$prev]}" -- $cur) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
complete -F _virtigoctl_complete wit
|
Loading…
Reference in New Issue