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.
87 lines
1.8 KiB
87 lines
1.8 KiB
# Easy Engine Auto Complete Feature
|
|
|
|
|
|
|
|
EEAUTO()
|
|
{
|
|
# Get Current Word
|
|
local CURRENT=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
# Get Previous Word
|
|
local PREVIOUS=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
# Use All Word Twice
|
|
local EEALL=${COMP_WORDS[COMP_CWORD-2]}
|
|
|
|
# List Of Suggested Words
|
|
case "$PREVIOUS" in
|
|
|
|
# List Of Suggested Words
|
|
easyengine|ee)
|
|
COMPREPLY=( $(compgen -W "system site help" -- $CURRENT) )
|
|
return 0
|
|
;;
|
|
|
|
system)
|
|
COMPREPLY=( $( compgen -W "install remove purge config" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
install|remove|purge)
|
|
COMPREPLY=( $( compgen -W "nginx php mysql pma postfix all" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
config)
|
|
COMPREPLY=( $( compgen -W "get set" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
get|set)
|
|
COMPREPLY=( $( compgen -W "memory timeout" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
|
|
site)
|
|
COMPREPLY=( $( compgen -W "list listall show info create enable disable delete backup restore update" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
show|info|enable|db|files)
|
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
all)
|
|
if [ "$EEALL" = "delete" ]
|
|
then
|
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
|
fi
|
|
return 0
|
|
;;
|
|
|
|
disable)
|
|
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2>/dev/null)' -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
create|update)
|
|
COMPREPLY=( $( compgen -W "html php wpsingle wpsubdir wpsubdomain" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
wpsingle|wpsubdir|wpsubdomain)
|
|
COMPREPLY=( $( compgen -W "basic w3tc wpsc wpfc" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
delete)
|
|
COMPREPLY=( $( compgen -W "files db all" -- $CURRENT ) )
|
|
return 0
|
|
;;
|
|
|
|
esac
|
|
}
|
|
|
|
complete -F EEAUTO ee easyengine
|
|
|