-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrabbitmq.completions.bash
158 lines (151 loc) · 4.98 KB
/
rabbitmq.completions.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# shellcheck shell=bash
cite about-completion
about-completion 'RabbitMQ bash completions'
_rabbitmqadmin () {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="list show declare delete close purge import export get publish help"
fargs="--help --host --port --vhost --username --password --format --depth --sort --sort-reverse"
case "${prev}" in
list)
COMPREPLY=( $(compgen -W 'users vhosts connections exchanges bindings permissions channels parameters consumers queues policies nodes' -- ${cur}) )
return 0
;;
show)
COMPREPLY=( $(compgen -W 'overview' -- ${cur}) )
return 0
;;
declare)
COMPREPLY=( $(compgen -W 'queue vhost user exchange policy parameter permission binding' -- ${cur}) )
return 0
;;
delete)
COMPREPLY=( $(compgen -W 'queue vhost user exchange policy parameter permission binding' -- ${cur}) )
return 0
;;
close)
COMPREPLY=( $(compgen -W 'connection' -- ${cur}) )
return 0
;;
purge)
COMPREPLY=( $(compgen -W 'queue' -- ${cur}) )
return 0
;;
export)
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
import)
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
help)
opts="subcommands config"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-H)
COMPREPLY=( $(compgen -A hostname ${cur}) )
return 0
;;
--host)
COMPREPLY=( $(compgen -A hostname ${cur}) )
return 0
;;
-V)
opts="$(rabbitmqadmin -q -f bash list vhosts)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
--vhost)
opts="$(rabbitmqadmin -q -f bash list vhosts)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-u)
opts="$(rabbitmqadmin -q -f bash list users)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
--username)
opts="$(rabbitmqadmin -q -f bash list users)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-f)
COMPREPLY=( $(compgen -W "raw_json long pretty_json kvp tsv table bash" -- ${cur}) )
return 0
;;
--format)
COMPREPLY=( $(compgen -W "raw_json long pretty_json kvp tsv table bash" -- ${cur}) )
return 0
;;
user)
opts="$(rabbitmqadmin -q -f bash list users)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
vhost)
opts="$(rabbitmqadmin -q -f bash list vhosts)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
connection)
opts="$(rabbitmqadmin -q -f bash list connections)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
exchange)
opts="$(rabbitmqadmin -q -f bash list exchanges)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
binding)
opts="$(rabbitmqadmin -q -f bash list bindings)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
permission)
opts="$(rabbitmqadmin -q -f bash list permissions)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
channel)
opts="$(rabbitmqadmin -q -f bash list channels)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
parameter)
opts="$(rabbitmqadmin -q -f bash list parameters)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
consumer)
opts="$(rabbitmqadmin -q -f bash list consumers)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
queue)
opts="$(rabbitmqadmin -q -f bash list queues)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
policie)
opts="$(rabbitmqadmin -q -f bash list policies)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
node)
opts="$(rabbitmqadmin -q -f bash list nodes)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=($(compgen -W "${opts} ${fargs}" -- ${cur}))
return 0
}
complete -F _rabbitmqadmin rabbitmqadmin