Current File : //etc/bash_completion.d/mogwai |
_mogwai()
{
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
local mogwai_common_opts="--help --version --quiet --no-interaction"
local mogwai_cmds="chpasswd configure get_licence help init_session_db \
list sqlite_migration usrlogin \
backup:plan certificate:letsencrypt:update certificate:list \
fastpanel:migration fix:domain flush:default:firewall \
load:default:firewall load:php_modules \
mogwai:bye-bye mogwai:run panel:create:user panel:cron \
scan:virtualhost virtualhost:configuration:load"
local mogwai_chpasswd_opts="--username= --password="
local mogwai_configure_opts="--default --revert"
local mogwai_list_opts="--xml --raw --format="
local mogwai_usrlogin_opts="--username"
local mogwai_backup_plan_opts="--plan="
local mogwai_doctrine_schema_update_opts="--complete --dump-sql --force --em"
local mogwai_fastpanel_migration_opts="--username --password"
local mogwai_mogwai_run_opts="--detach --with-leaks"
local mogwai_panel_create_user_opts="--username= --password= --ex"
local mogwai_scan_virtualhost_opts="--configuration="
local mogwai_sync_domains_opts="--sync-missing="
local mogwai_change_ip_opts="--from= --to="
case $COMP_CWORD in
1)
# command or global option
COMPREPLY=( $( compgen -W "$mogwai_cmds" -- $cur ) )
;;
*)
if [[ "${prev::1}" != "--" ]]; then
# List options
local cmd=${COMP_WORDS[1]}
if [ ${cmd::1} = "--" ] ; then
# --verbose or --quiet used
cmd=${COMP_WORDS[2]}
fi
case "$cmd" in
chpasswd)
COMPREPLY=( $( compgen -W "$mogwai_chpasswd_opts" -- $cur ) )
;;
configure)
COMPREPLY=( $( compgen -W "$mogwai_configure_opts" -- $cur ) )
;;
list)
COMPREPLY=( $( compgen -W "$mogwai_list_opts" -- $cur ) )
;;
sync_domains)
COMPREPLY=( $( compgen -W "$mogwai_sync_domains_opts" -- $cur ) )
;;
change_ip)
COMPREPLY=( $( compgen -W "$mogwai_change_ip_opts" -- $cur ) )
;;
usrlogin)
COMPREPLY=( $( compgen -W "$mogwai_usrlogin_opts" -- $cur ) )
;;
backup:plan)
COMPREPLY=( $( compgen -W "$mogwai_backup_plan_opts" -- $cur ) )
;;
doctrine:schema:update)
COMPREPLY=( $( compgen -W "$mogwai_doctrine_schema_update_opts" -- $cur ) )
;;
fastpanel:migration)
COMPREPLY=( $( compgen -W "$mogwai_fastpanel_migration_opts" -- $cur ) )
;;
mogwai:run)
COMPREPLY=( $( compgen -W "$mogwai_mogwai_run_opts" -- $cur ) )
;;
panel:create:user)
COMPREPLY=( $( compgen -W "$mogwai_panel_create_user_opts" -- $cur ) )
;;
scan:virtualhost)
COMPREPLY=( $( compgen -W "$mogwai_scan_virtualhost_opts" -- $cur ) )
;;
help)
COMPREPLY=( $( compgen -W "$mogwai_cmds" -- $cur ) )
;;
*)
;;
esac
else
COMPREPLY=( $( compgen -W "" -- $cur ) )
fi
;;
esac
return 0
}
complete -F _mogwai mogwai