forked from nanovms/ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_completion.sh
29 lines (26 loc) · 953 Bytes
/
bash_completion.sh
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
#!/bin/sh
__nanovms_ops_completions() {
if [ "${#COMP_WORDS[@]}" = "2" ]; then
COMPREPLY+=($(compgen -W "help build deploy image instance pkg profile run update version volume" "${COMP_WORDS[1]}"))
return
fi
if [ "${#COMP_WORDS[@]}" = "3" ]; then
case "${COMP_WORDS[1]}" in
pkg)
COMPREPLY+=($(compgen -W "contents describe get list load" "${COMP_WORDS[2]}"))
;;
instance)
COMPREPLY+=($(compgen -W "create delete list logs start stop" "${COMP_WORDS[2]}"))
;;
image)
COMPREPLY+=($(compgen -W "create delete list resize sync" "${COMP_WORDS[2]}"))
;;
volume)
COMPREPLY+=($(compgen -W "attach create delete detach list" "${COMP_WORDS[2]}"))
;;
*)
esac
return
fi
}
complete -F __nanovms_ops_completions ops