Browse Source

better autocompletion

bugfixes
harshadyeola 10 years ago
parent
commit
26a57e03d2
  1. 28
      config/bash_completion.d/ee_auto.rc

28
config/bash_completion.d/ee_auto.rc

@ -29,7 +29,7 @@ _ee_complete()
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE # IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
"debug") "debug")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--start --nginx --php --fpm --mysql -i --interactive --stop " \ -W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --start --nginx --php --fpm --mysql -i --interactive --stop " \
-- $cur) ) -- $cur) )
;; ;;
@ -126,20 +126,25 @@ _ee_complete()
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--db --files --all" \ -W "--db --files --all" \
-- $cur) ) -- $cur) )
;;
*)
;;
esac esac
fi fi
case "$prev" in case "$prev" in
"--wpsubdir" | "--wpsubdomain") "--wp" | "--wpsubdir" | "--wpsubdomain")
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
-W "--w3tc --wpfc --wpsc" \ -W "--w3tc --wpfc --wpsc" \
-- $cur) ) -- $cur) )
;; ;;
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot") "--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot")
if [[ ${COMP_WORDS[1]} == "stack" ]]; then if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot" retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot"
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
retlist="--nginx --php --mysql --postfix --memcache --dovecot"
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop" retlist="--start --nginx --php --fpm --mysql -i --interactive --stop"
fi fi
@ -149,7 +154,7 @@ _ee_complete()
-- $cur) ) -- $cur) )
;; ;;
"--db" | "--files" | "--all") "--db" | "--files" )
retlist="--db --files --all" retlist="--db --files --all"
ret="${retlist[@]/$prev}" ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \ COMPREPLY=( $(compgen \
@ -157,6 +162,19 @@ _ee_complete()
-- $cur) ) -- $cur) )
;; ;;
"--all")
if [ ${COMP_WORDS[1]} == "clean" ]; then
retlist="--memcache --opcache --fastcgi"
else
retlist="--db --files"
fi
ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \
-W "$(echo $ret)" \
-- $cur) )
;;
"--memcache" | "--opcache" | "--fastcgi" | "--all") "--memcache" | "--opcache" | "--fastcgi" | "--all")
retlist="--memcache --opcache --fastcgi --all" retlist="--memcache --opcache --fastcgi --all"
ret="${retlist[@]/$prev}" ret="${retlist[@]/$prev}"

Loading…
Cancel
Save