You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.0 KiB
129 lines
3.0 KiB
11 years ago
|
# EasyEngine Auto Complete Feature
|
||
12 years ago
|
|
||
|
|
||
|
|
||
|
EEAUTO()
|
||
|
{
|
||
|
# Get Current Word
|
||
|
local CURRENT=${COMP_WORDS[COMP_CWORD]}
|
||
|
|
||
|
# Get Previous Word
|
||
|
local PREVIOUS=${COMP_WORDS[COMP_CWORD-1]}
|
||
11 years ago
|
local PREVIOUS2=${COMP_WORDS[COMP_CWORD-2]}
|
||
|
local PREVIOUS3=${COMP_WORDS[COMP_CWORD-3]}
|
||
12 years ago
|
|
||
12 years ago
|
# List Of Suggested Words
|
||
|
case "$PREVIOUS" in
|
||
12 years ago
|
|
||
|
# List Of Suggested Words
|
||
|
easyengine|ee)
|
||
11 years ago
|
COMPREPLY=( $(compgen -W "version info update help system site debug" -- $CURRENT) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
12 years ago
|
system)
|
||
11 years ago
|
COMPREPLY=( $( compgen -W "install remove purge status start stop reload restart" -- $CURRENT ) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
|
install|remove|purge)
|
||
11 years ago
|
COMPREPLY=( $( compgen -W "nginx php mysql phpmyadmin postfix all" -- $CURRENT ) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
site)
|
||
|
COMPREPLY=( $( compgen -W "list show info create enable disable delete edit" -- $CURRENT ) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
list)
|
||
|
COMPREPLY=( $( compgen -W "enable available" -- $CURRENT ) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
show|delete|--stop)
|
||
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
info|enable)
|
||
|
if [ "$PREVIOUS2" = "site" ]
|
||
|
then
|
||
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
||
|
fi
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
edit)
|
||
|
if [ "$PREVIOUS2" = "site" ]
|
||
|
then
|
||
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
||
|
fi
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
disable)
|
||
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
--wpsubdir|--wpsubdomain)
|
||
|
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
debug)
|
||
|
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
--nginx)
|
||
|
COMPREPLY=( $(compgen -W "--rewrite --php --fpm --mysql --wp --stop" -- $CURRENT) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
--rewrite)
|
||
|
COMPREPLY=( $(compgen -W "--nginx --php --fpm --mysql --wp --stop" -- $CURRENT) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
--php)
|
||
|
COMPREPLY=( $(compgen -W "--nginx --rewrite --fpm --mysql --wp --stop" -- $CURRENT) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
11 years ago
|
|
||
|
--fpm)
|
||
|
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --mysql --wp --stop" -- $CURRENT) )
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
11 years ago
|
|
||
11 years ago
|
--mysql)
|
||
|
COMPREPLY=( $(compgen -W "--nginx --rewrite --php --fpm --wp --stop" -- $CURRENT) )
|
||
12 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
--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
|
||
11 years ago
|
return 0
|
||
|
;;
|
||
|
|
||
11 years ago
|
*)
|
||
11 years ago
|
if [ "$PREVIOUS2" = "create" ]
|
||
11 years ago
|
then
|
||
|
COMPREPLY=( $( compgen -W "--html --php --wp --wpsubdir --wpsubdomain" -- $CURRENT ) )
|
||
11 years ago
|
elif [ "$PREVIOUS2" = "delete" ]
|
||
11 years ago
|
then
|
||
|
COMPREPLY=( $( compgen -W "--db --all --files" -- $CURRENT ) )
|
||
|
fi
|
||
|
return 0
|
||
|
;;
|
||
12 years ago
|
esac
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
complete -F EEAUTO ee easyengine
|