-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbash-completion
More file actions
99 lines (94 loc) · 4.5 KB
/
bash-completion
File metadata and controls
99 lines (94 loc) · 4.5 KB
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
_coscale-cli()
{
local object action cur
COMPREPLY=()
object="${COMP_WORDS[1]}"
action="${COMP_WORDS[2]}"
cur="${COMP_WORDS[COMP_CWORD]}"
opts="event server servergroup metric metricgroup data alert config"
auth="--api-url --app-id --access-token --rawOutput"
case "${object}" in
event)
case "${action}" in
list) opts="${auth}" ;;
get) opts="--id --name ${auth}" ;;
delete) opts="--id --name ${auth}" ;;
new) opts="--name --description --attributeDescriptions --source ${auth}" ;;
update) opts="--id --name --description --attributeDescriptions --source ${auth}" ;;
newdata) opts="--name --id --message --subject --attribute --timestamp --stopTime ${auth}" ;;
updatedata) opts="--name --id --dataid --message --subject --attribute --timestamp --stopTime ${auth}" ;;
deletedata) opts="--id --dataid ${auth}" ;;
*) opts="list get delete new update newdata updatedata deletedata" ;;
esac
;;
server)
case "${action}" in
list) opts="${auth}" ;;
get) opts="--id --name ${auth}" ;;
delete) opts="--id --name ${auth}" ;;
new) opts="--name --description --serverType --source ${auth}" ;;
update) opts="--name --id --description --serverType --state --source ${auth}" ;;
*) opts="list get delete new update" ;;
esac
;;
servergroup)
case "${action}" in
list) opts="${auth}" ;;
get) opts="--id --name ${auth}" ;;
delete) opts="--id --name ${auth}" ;;
new) opts="--name --description --type --state --source ${auth}" ;;
update) opts="--name --id --description --type --state --source ${auth}" ;;
addServer) opts="--idServer --nameServer --idGroup --nameGroup ${auth}" ;;
deleteServer) opts="--idServer --nameServer --idGroup --nameGroup ${auth}" ;;
*) opts="list get delete new update addServer deleteServer" ;;
esac
;;
metric)
case "${action}" in
list) opts="${auth}" ;;
listbygroup) opts="--id --name ${auth}" ;;
new) opts="--name --dataType --subject --period --description --unit --attachTo --source ${auth}" ;;
update) opts="--name --id --description --dataType --subject --unit --period --attachTo --source ${auth}" ;;
*) opts="list listbygroup new update"
esac
;;
metricgroup)
case "${action}" in
list) opts="${auth}" ;;
get) opts="--id --name ${auth}" ;;
addMetric) opts="--idMetric --nameMetric --idGroup --nameGroup ${auth}" ;;
deleteMetric) opts="--idMetric --nameMetric --idGroup --nameGroup ${auth}" ;;
new) opts="--name --subject --description --state --source ${auth}" ;;
update) opts="--name --id --description --type --state --source ${auth}" ;;
*) opts="list get addMetric deleteMetric new update"
esac
;;
data)
case "${action}" in
get) opts="--id --subjectIds --start --stop --aggregator --aggregateSubjects ${auth}" ;;
insert) opts="--data ${auth}" ;;
*) opts="get insert"
esac
;;
alert)
case "${action}" in
list) opts="${auth}" ;;
acknowledge) opts="--id --name ${auth}" ;;
resolve) opts="--id --name ${auth}" ;;
*) opts="list acknowledge resolve"
esac
;;
config)
case "${action}" in
check) opts="" ;;
set) opts="--api-url --app-id --access-token" ;;
*) opts="check set"
esac
;;
*)
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
}
complete -F _coscale-cli coscale-cli