blob: 438469409ad01d17d2a6d34abe5e23c6b763bfdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|