Skip to content

Commit 26a57e0

Browse files
committed
better autocompletion
1 parent ee9b4da commit 26a57e0

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

config/bash_completion.d/ee_auto.rc

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _ee_complete()
2929
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
3030
"debug")
3131
COMPREPLY=( $(compgen \
32-
-W "--start --nginx --php --fpm --mysql -i --interactive --stop " \
32+
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --start --nginx --php --fpm --mysql -i --interactive --stop " \
3333
-- $cur) )
3434
;;
3535

@@ -126,20 +126,25 @@ _ee_complete()
126126
COMPREPLY=( $(compgen \
127127
-W "--db --files --all" \
128128
-- $cur) )
129-
129+
;;
130+
*)
131+
;;
130132
esac
133+
131134
fi
132135

133136
case "$prev" in
134-
"--wpsubdir" | "--wpsubdomain")
137+
"--wp" | "--wpsubdir" | "--wpsubdomain")
135138
COMPREPLY=( $(compgen \
136139
-W "--w3tc --wpfc --wpsc" \
137140
-- $cur) )
138141
;;
139142

140143
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot")
141-
if [[ ${COMP_WORDS[1]} == "stack" ]]; then
144+
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
142145
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot"
146+
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
147+
retlist="--nginx --php --mysql --postfix --memcache --dovecot"
143148
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
144149
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop"
145150
fi
@@ -149,14 +154,27 @@ _ee_complete()
149154
-- $cur) )
150155
;;
151156

152-
"--db" | "--files" | "--all")
157+
"--db" | "--files" )
153158
retlist="--db --files --all"
154159
ret="${retlist[@]/$prev}"
155160
COMPREPLY=( $(compgen \
156161
-W "$(echo $ret)" \
157162
-- $cur) )
158163
;;
159164

165+
"--all")
166+
if [ ${COMP_WORDS[1]} == "clean" ]; then
167+
retlist="--memcache --opcache --fastcgi"
168+
else
169+
retlist="--db --files"
170+
171+
fi
172+
ret="${retlist[@]/$prev}"
173+
COMPREPLY=( $(compgen \
174+
-W "$(echo $ret)" \
175+
-- $cur) )
176+
;;
177+
160178
"--memcache" | "--opcache" | "--fastcgi" | "--all")
161179
retlist="--memcache --opcache --fastcgi --all"
162180
ret="${retlist[@]/$prev}"

0 commit comments

Comments
 (0)