forked from Anfauglith/core-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cccomp.bash
57 lines (50 loc) · 1.42 KB
/
cccomp.bash
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#/usr/bin/env bash
ccontrol_completions () {
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $(compgen -W "install update remove secret start restart stop status logs snapshot system config database rollback plugin" -- $cur) )
elif [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
"install")
COMPREPLY=( $(compgen -W "core" -- $cur) )
;;
"update")
COMPREPLY=( $(compgen -W "core self check" -- $cur) )
;;
"remove")
COMPREPLY=( $(compgen -W "core self" -- $cur) )
;;
"secret")
COMPREPLY=( $(compgen -W "set clear" -- $cur) )
;;
"start"|"stop"|"status"|"logs")
COMPREPLY=( $(compgen -W "relay forger all" -- $cur) )
;;
"restart")
COMPREPLY=( $(compgen -W "relay forger all safe" -- $cur) )
;;
"snapshot")
COMPREPLY=( $(compgen -W "create restore" -- $cur) )
;;
"system")
COMPREPLY=( $(compgen -W "info update" -- $cur) )
;;
"config")
COMPREPLY=( $(compgen -W "reset" -- $cur) )
;;
"database")
COMPREPLY=( $(compgen -W "clear" -- $cur) )
;;
"plugin")
COMPREPLY=( $(compgen -W "list add remove update" -- $cur) )
;;
*)
;;
esac
fi
return 0
}
complete -F ccontrol_completions ccontrol