This repository has been archived by the owner on Aug 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 208
/
rhc
115 lines (110 loc) · 4.19 KB
/
rhc
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#
# This is the bash auto completion script for the rhc command
#
_rhc()
{
local cur opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [ $COMP_CWORD -eq 1 ]; then
opts="domain app sshkey port-forward server setup help"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
elif [ $COMP_CWORD -eq 2 ]; then
case "${COMP_WORDS[1]}" in
domain)
opts="create show alter status destroy"
;;
app)
opts="create show start stop force-stop restart reload status destroy tidy add-alias remove-alias snapshot tail cartridge"
;;
sshkey)
opts="add update remove list"
;;
port-forward)
opts="--debug --help --rhlogin --password --namespace --config --timeout --app"
;;
*)
opts=""
;;
esac
elif [ $COMP_CWORD -eq 3 ]; then
case "${COMP_WORDS[1]}" in
domain)
case "${COMP_WORDS[2]}" in
create | alter | destroy)
opts="--debug --help --rhlogin --password --namespace --config --timeout"
;;
show | status)
opts="--debug --help --rhlogin --password --config --timeout"
;;
*)
;;
esac
;;
app)
case "${COMP_WORDS[2]}" in
create)
opts="--debug --help --rhlogin --password --no-dns --nogit --app --repo --type --enable-jenkins --config --timeout"
;;
show | start | stop | force-stop | restart | reload | status | destroy | tidy | add-alias | remove-alias | destroy )
opts="--debug --help --rhlogin --password --app --alias --bypass --config --timeout"
;;
tail)
opts="--debug --help --rhlogin --password --app --opts --filepath --config --timeout"
;;
snapshot)
opts="save restore"
;;
cartridge)
opts="add remove stop start restart status reload list"
;;
*)
;;
esac
;;
sshkey)
case "${COMP_WORDS[2]}" in
add | update)
opts="--debug --help --rhlogin --password --identifier --ssh --config --timeout"
;;
remove)
opts="--debug --help --rhlogin --password --identifier --config --timeout"
;;
list)
opts="--debug --help --rhlogin --password --config --timeout"
;;
*)
;;
esac
;;
esac
elif [ $COMP_CWORD -eq 4 ]; then
case "${COMP_WORDS[1]}" in
app)
case "${COMP_WORDS[2]}" in
snapshot)
case "${COMP_WORDS[3]}" in
save | restore)
opts="--debug --help --rhlogin --password --app --filepath --config --timeout"
;;
*)
;;
esac
;;
cartridge)
case "${COMP_WORDS[3]}" in
add | remove | stop | start | restart | status | reload | list)
opts="--debug --help --rhlogin --password --app --cartridge --config --timeout"
;;
*)
;;
esac
;;
esac
;;
esac
fi
if [ ${#opts[@]} -gt 0 ]; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ); fi
return 0
}
complete -o default -F _rhc rhc