-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path_transloadify
123 lines (121 loc) · 2.43 KB
/
_transloadify
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
function _transloadify {
local opts=(--verbose --quiet --json)
local mode=""
local action=""
for word in "${COMP_WORDS[@]}"; do
if [ -z "$mode" ]; then
case "$word" in
register)
mode=register
continue
;;
assemblies|assembly|a)
mode=assemblies
continue
;;
templates|template|t)
mode=templates
continue
;;
assembly-notifications|assembly-notification|notifications|notification|n)
mode=assembly-notifications
continue
;;
bills|bill|b)
mode=bills
continue
;;
esac
fi
if [ -z "$action" ]; then
case "$word" in
create|new|c)
action=create
continue
;;
delete|cancel|d)
action=delete
continue
;;
modify|edit|alter|m)
action=modify
continue
;;
replay|r)
action=replay
continue
;;
list|l)
action=list
continue
;;
get|info|view|display|g)
action=get
continue
;;
esac
fi
done
if [ -z "$mode" ]; then
opts+=(register assemblies templates assembly-notifications notifications bills)
fi
if [ -z "$action" ]; then
case "$mode" in
register)
;;
assemblies)
opts+=(create new delete cancel replay list get info view display)
;;
templates)
opts+=(create new delete modify edit alter list get info view display)
;;
assembly-notifications)
opts+=(replay list)
;;
bills)
opts+=(get info view display)
;;
"")
opts+=(create new delete cancel modify edit alter replay list get info view display)
;;
esac
fi
if ([ -z "$action" ] && [ -z "$mode" ]) || ([ "$mode" == "assemblies" ] && [ "$action" == "create" ]); then
opts+=(--steps --template --field --watch --recursive --input --output --delete-after-processing --reprocess-stale)
fi
case "$mode" in
assemblies)
case "$action" in
list)
opts+=(--before --after --keywords --fields)
;;
replay)
opts+=(--field --steps --notify-url --reparse-template)
;;
esac
;;
templates)
case "$action" in
modify)
opts+=(--name)
;;
list)
opts+=(--before --after --sort --fields --order)
;;
esac
;;
assembly-notifications)
case "$action" in
replay)
opts+=(--notify-url)
;;
list)
opts+=(--failed --successful)
;;
esac
;;
esac
COMPREPLY=( $(compgen -W "${opts[*]}" -- "${COMP_WORDS[COMP_CWORD]}") )
return 0
}
complete -F _transloadify transloadify