From dde4125206b9d39aa6e62c542b36d2f31447e3a3 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 16 Apr 2015 13:52:38 +0530 Subject: [PATCH] modified autocomplete --- config/bash_completion.d/ee_auto.rc | 69 ++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/config/bash_completion.d/ee_auto.rc b/config/bash_completion.d/ee_auto.rc index 9d788b8f..26d30ad3 100644 --- a/config/bash_completion.d/ee_auto.rc +++ b/config/bash_completion.d/ee_auto.rc @@ -96,12 +96,8 @@ _ee_complete() "edit" | "enable" | "info" | "log" | "show" | "cd" | "update" | "delete") if [ ${COMP_WORDS[1]} == "log" ]; then COMPREPLY=( $(compgen \ - -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access" \ + -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ -- $cur) ) - elif [ ${COMP_WORDS[1]} == "edit" ]; then - COMPREPLY=( $(compgen \ - -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --pagespeed" \ - -- $cur) ) else COMPREPLY=( $(compgen \ -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null)" \ @@ -111,13 +107,13 @@ _ee_complete() "gzip") COMPREPLY=( $(compgen \ - -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access" \ + -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ -- $cur) ) ;; "mail") COMPREPLY=( $(compgen \ - -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access --to=" \ + -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access --to=" \ -- $cur) ) ;; @@ -174,6 +170,34 @@ _ee_complete() -W "--db --files --all --no-prompt" \ -- $cur) ) ;; + "show") + COMPREPLY=( $(compgen \ + -W "--wp --nginx --php --fpm --mysql --access" \ + -- $cur) ) + ;; + + "gzip") + COMPREPLY=( $(compgen \ + -W "--wp --nginx --php --fpm --mysql --access" \ + -- $cur) ) + ;; + + "mail") + COMPREPLY=( $(compgen \ + -W "--wp --nginx --php --fpm --mysql --access --to=" \ + -- $cur) ) + ;; + + "reset") + COMPREPLY=( $(compgen \ + -W "--wp --nginx --php --fpm --mysql --wp --access --slow-log-db" \ + -- $cur) ) + ;; + edit) + COMPREPLY=( $(compgen \ + -W "--pagespeed" \ + -- $cur) ) + ;; *) ;; esac @@ -204,6 +228,18 @@ _ee_complete() if [[ $prev == '--mysql' ]]; then retlist="--start --nginx --php --fpm --mysql -i --interactive --stop --import-slow-log" fi + elif [[ ${COMP_WORDS[1]} == "log" ]]; then + if [ ${COMP_WORDS[2]} == "show" ]; then + retlist="--access --nginx --php --mysql --fpm --wp" + + elif [ ${COMP_WORDS[2]} == "reset" ]; then + retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db" + + + elif [ ${COMP_WORDS[2]} == "mail" ]; then + retlist="--access --nginx --php --mysql --fpm --wp --to=" + + fi fi ret="${retlist[@]/$prev}" COMPREPLY=( $(compgen \ @@ -246,6 +282,25 @@ _ee_complete() -W "$(echo $ret)" \ -- $cur) ) ;; + "--access" | "--fpm" | "--wp" | "--slow-log-db") + if [[ ${COMP_WORDS[1]} == "log" ]]; then + if [ ${COMP_WORDS[2]} == "show" ]; then + retlist="--access --nginx --php --mysql --fpm --wp" + + elif [ ${COMP_WORDS[2]} == "reset" ]; then + retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db" + + + elif [ ${COMP_WORDS[2]} == "mail" ]; then + retlist="--access --nginx --php --mysql --fpm --wp --to=" + + fi + fi + ret="${retlist[@]/$prev}" + COMPREPLY=( $(compgen \ + -W "$(echo $ret)" \ + -- $cur) ) + ;; *) ;; esac