Browse Source

Fixed Autocompletion #185

old-stable
Mitesh Shah 11 years ago
parent
commit
15af7b313b
  1. 84
      etc/bash_completion.d/ee

84
etc/bash_completion.d/ee

@ -9,9 +9,8 @@ EEAUTO()
# Get Previous Word
local PREVIOUS=${COMP_WORDS[COMP_CWORD-1]}
# Use Word Twice In Auto Completion
local EECOMMON=${COMP_WORDS[COMP_CWORD-2]}
local PREVIOUS2=${COMP_WORDS[COMP_CWORD-2]}
local PREVIOUS3=${COMP_WORDS[COMP_CWORD-3]}
# List Of Suggested Words
case "$PREVIOUS" in
@ -32,92 +31,97 @@ EEAUTO()
return 0
;;
debug)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
site)
COMPREPLY=( $( compgen -W "list show info create enable disable delete edit" -- $CURRENT ) )
return 0
;;
--nginx)
COMPREPLY=( $(compgen -W "--rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
list)
COMPREPLY=( $( compgen -W "enable available" -- $CURRENT ) )
return 0
;;
--rewrite)
COMPREPLY=( $(compgen -W "--nginx --php --fpm --mysql --wp --stop" -- $CURRENT) )
show|delete|--stop)
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
return 0
;;
--php)
COMPREPLY=( $(compgen -W "--nginx --rewrite --fpm --mysql --wp --stop" -- $CURRENT) )
info|enable)
if [ "$PREVIOUS2" = "site" ]
then
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
fi
return 0
;;
--fpm)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --mysql --wp --stop" -- $CURRENT) )
edit)
if [ "$PREVIOUS2" = "site" ]
then
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
fi
return 0
;;
--mysql)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --wp --stop" -- $CURRENT) )
disable)
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2>/dev/null)' -- $CURRENT ) )
return 0
;;
--wp)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --mysql --stop" -- $CURRENT) )
--wpsubdir|--wpsubdomain)
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) )
return 0
;;
site)
COMPREPLY=( $( compgen -W "list show info create enable disable delete edit" -- $CURRENT ) )
debug)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
return 0
;;
list)
COMPREPLY=( $( compgen -W "enable available" -- $CURRENT ) )
--nginx)
COMPREPLY=( $(compgen -W "--rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
return 0
;;
show|enable|delete|--stop)
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
--rewrite)
COMPREPLY=( $(compgen -W "--nginx --php --fpm --mysql --wp --stop" -- $CURRENT) )
return 0
;;
info)
if [ "$EECOMMON" = "site" ]
then
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
fi
--php)
COMPREPLY=( $(compgen -W "--nginx --rewrite --fpm --mysql --wp --stop" -- $CURRENT) )
return 0
;;
edit)
if [ "$EECOMMON" = "site" ]
then
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
fi
--fpm)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --mysql --wp --stop" -- $CURRENT) )
return 0
;;
disable)
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2>/dev/null)' -- $CURRENT ) )
--mysql)
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --wp --stop" -- $CURRENT) )
return 0
;;
--wp|--wpsubdir|--wpsubdomain)
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) )
--wp)
if [ "$PREVIOUS3" = "create" ]
then
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) )
else
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --mysql --stop" -- $CURRENT) )
fi
return 0
;;
*)
if [ "$EECOMMON" = "create" ]
if [ "$PREVIOUS2" = "create" ]
then
COMPREPLY=( $( compgen -W "--html --php --wp --wpsubdir --wpsubdomain" -- $CURRENT ) )
elif [ "$EECOMMON" = "delete" ]
elif [ "$PREVIOUS2" = "delete" ]
then
COMPREPLY=( $( compgen -W "--db --all --files" -- $CURRENT ) )
fi
return 0
;;
esac
}

Loading…
Cancel
Save