Skip to content

Commit dde4125

Browse files
committed
modified autocomplete
1 parent 53b7441 commit dde4125

File tree

1 file changed

+62
-7
lines changed

1 file changed

+62
-7
lines changed

config/bash_completion.d/ee_auto.rc

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,8 @@ _ee_complete()
9696
"edit" | "enable" | "info" | "log" | "show" | "cd" | "update" | "delete")
9797
if [ ${COMP_WORDS[1]} == "log" ]; then
9898
COMPREPLY=( $(compgen \
99-
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access" \
99+
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \
100100
-- $cur) )
101-
elif [ ${COMP_WORDS[1]} == "edit" ]; then
102-
COMPREPLY=( $(compgen \
103-
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --pagespeed" \
104-
-- $cur) )
105101
else
106102
COMPREPLY=( $(compgen \
107103
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null)" \
@@ -111,13 +107,13 @@ _ee_complete()
111107

112108
"gzip")
113109
COMPREPLY=( $(compgen \
114-
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access" \
110+
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \
115111
-- $cur) )
116112
;;
117113

118114
"mail")
119115
COMPREPLY=( $(compgen \
120-
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access --to=" \
116+
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access --to=" \
121117
-- $cur) )
122118
;;
123119

@@ -174,6 +170,34 @@ _ee_complete()
174170
-W "--db --files --all --no-prompt" \
175171
-- $cur) )
176172
;;
173+
"show")
174+
COMPREPLY=( $(compgen \
175+
-W "--wp --nginx --php --fpm --mysql --access" \
176+
-- $cur) )
177+
;;
178+
179+
"gzip")
180+
COMPREPLY=( $(compgen \
181+
-W "--wp --nginx --php --fpm --mysql --access" \
182+
-- $cur) )
183+
;;
184+
185+
"mail")
186+
COMPREPLY=( $(compgen \
187+
-W "--wp --nginx --php --fpm --mysql --access --to=" \
188+
-- $cur) )
189+
;;
190+
191+
"reset")
192+
COMPREPLY=( $(compgen \
193+
-W "--wp --nginx --php --fpm --mysql --wp --access --slow-log-db" \
194+
-- $cur) )
195+
;;
196+
edit)
197+
COMPREPLY=( $(compgen \
198+
-W "--pagespeed" \
199+
-- $cur) )
200+
;;
177201
*)
178202
;;
179203
esac
@@ -204,6 +228,18 @@ _ee_complete()
204228
if [[ $prev == '--mysql' ]]; then
205229
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop --import-slow-log"
206230
fi
231+
elif [[ ${COMP_WORDS[1]} == "log" ]]; then
232+
if [ ${COMP_WORDS[2]} == "show" ]; then
233+
retlist="--access --nginx --php --mysql --fpm --wp"
234+
235+
elif [ ${COMP_WORDS[2]} == "reset" ]; then
236+
retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db"
237+
238+
239+
elif [ ${COMP_WORDS[2]} == "mail" ]; then
240+
retlist="--access --nginx --php --mysql --fpm --wp --to="
241+
242+
fi
207243
fi
208244
ret="${retlist[@]/$prev}"
209245
COMPREPLY=( $(compgen \
@@ -246,6 +282,25 @@ _ee_complete()
246282
-W "$(echo $ret)" \
247283
-- $cur) )
248284
;;
285+
"--access" | "--fpm" | "--wp" | "--slow-log-db")
286+
if [[ ${COMP_WORDS[1]} == "log" ]]; then
287+
if [ ${COMP_WORDS[2]} == "show" ]; then
288+
retlist="--access --nginx --php --mysql --fpm --wp"
289+
290+
elif [ ${COMP_WORDS[2]} == "reset" ]; then
291+
retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db"
292+
293+
294+
elif [ ${COMP_WORDS[2]} == "mail" ]; then
295+
retlist="--access --nginx --php --mysql --fpm --wp --to="
296+
297+
fi
298+
fi
299+
ret="${retlist[@]/$prev}"
300+
COMPREPLY=( $(compgen \
301+
-W "$(echo $ret)" \
302+
-- $cur) )
303+
;;
249304
*)
250305
;;
251306
esac

0 commit comments

Comments
 (0)