-
Notifications
You must be signed in to change notification settings - Fork 1
/
squareone.autocompletion
195 lines (147 loc) · 4.2 KB
/
squareone.autocompletion
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
_so()
{
local cur script coms opts com
COMPREPLY=()
_get_comp_words_by_ref -n : cur words
# for an alias, get the real script behind it
if [[ $(type -t ${words[0]}) == "alias" ]]; then
script=$(alias ${words[0]} | sed -E "s/alias ${words[0]}='(.*)'/\1/")
else
script=${words[0]}
fi
# lookup for command
for word in ${words[@]:1}; do
if [[ $word != -* ]]; then
com=$word
break
fi
done
# completing for an option
if [[ ${cur} == --* ]] ; then
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --env"
case "$com" in
_complete)
opts="${opts} --shell --input --current --symfony"
;;
bootstrap)
opts="${opts} --multisite"
;;
completion)
opts="${opts} --debug"
;;
composer)
opts="${opts} "
;;
create)
opts="${opts} --remote --no-bootstrap --branch"
;;
docker)
opts="${opts} "
;;
docker-compose)
opts="${opts} "
;;
export-test-db)
opts="${opts} --output-path --container"
;;
help)
opts="${opts} --format --raw"
;;
list)
opts="${opts} --raw --format --short"
;;
logs)
opts="${opts} "
;;
migrate-domain)
opts="${opts} "
;;
open)
opts="${opts} "
;;
restart)
opts="${opts} "
;;
share)
opts="${opts} --content-dir --not-wordpress"
;;
shell)
opts="${opts} --user"
;;
start)
opts="${opts} --browser --path --remove-orphans --skip-global"
;;
stop)
opts="${opts} --remove-orphans"
;;
test)
opts="${opts} --xdebug --container --path --noclean --notty"
;;
wp)
opts="${opts} --xdebug --notty"
;;
xdebug)
opts="${opts} "
;;
config:compose-copy)
opts="${opts} "
;;
config:copy)
opts="${opts} "
;;
global:cert)
opts="${opts} --wildcard"
;;
global:logs)
opts="${opts} "
;;
global:myadmin)
opts="${opts} "
;;
global:portainer)
opts="${opts} "
;;
global:restart)
opts="${opts} "
;;
global:start)
opts="${opts} "
;;
global:status)
opts="${opts} "
;;
global:stop)
opts="${opts} "
;;
global:stop-all)
opts="${opts} "
;;
schedule:finish)
opts="${opts} "
;;
schedule:run)
opts="${opts} "
;;
self:update)
opts="${opts} "
;;
self:update-check)
opts="${opts} --force --only-new"
;;
vendor:publish)
opts="${opts} --force --all --provider --tag"
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
__ltrim_colon_completions "$cur"
return 0;
fi
# completing for a command
if [[ $cur == $com ]]; then
coms="_complete bootstrap completion composer create docker docker-compose export-test-db help list logs migrate-domain open restart share shell start stop test wp xdebug config:compose-copy config:copy global:cert global:logs global:myadmin global:portainer global:restart global:start global:status global:stop global:stop-all schedule:finish schedule:run self:update self:update-check vendor:publish"
COMPREPLY=($(compgen -W "${coms}" -- ${cur}))
__ltrim_colon_completions "$cur"
return 0
fi
}
complete -o default -F _so so