# EasyEngine Auto Complete Feature EEAUTO() { # Get Current Word local CURRENT=${COMP_WORDS[COMP_CWORD]} # Get Previous Word local PREVIOUS=${COMP_WORDS[COMP_CWORD-1]} # Use Word Twice In Auto Completion local EECOMMON=${COMP_WORDS[COMP_CWORD-2]} # List Of Suggested Words case "$PREVIOUS" in # List Of Suggested Words easyengine|ee) COMPREPLY=( $(compgen -W "version info update help system site" -- $CURRENT) ) return 0 ;; system) COMPREPLY=( $( compgen -W "install remove purge status start stop reload restart" -- $CURRENT ) ) return 0 ;; install|remove|purge) COMPREPLY=( $( compgen -W "nginx php mysql phpmyadmin postfix all" -- $CURRENT ) ) return 0 ;; site) COMPREPLY=( $( compgen -W "list show info create enable disable delete edit" -- $CURRENT ) ) return 0 ;; list) COMPREPLY=( $( compgen -W "enable available" -- $CURRENT ) ) return 0 ;; show|enable|delete) COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2>/dev/null)' -- $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 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 return 0 ;; disable) COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2>/dev/null)' -- $CURRENT ) ) return 0 ;; --wp|--wpsubdir|--wpsubdomain) COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) ) return 0 ;; *) if [ "$EECOMMON" = "create" ] then COMPREPLY=( $( compgen -W "--html --php --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) elif [ "$EECOMMON" = "delete" ] then COMPREPLY=( $( compgen -W "--db --all --files" -- $CURRENT ) ) fi return 0 ;; esac } complete -F EEAUTO ee easyengine