templates.bin.stool-complete Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of main Show documentation
Show all versions of main Show documentation
Stool's main component. Java Library, cli, setup code.
_stool_complete() {
local lib=${{stool.bin}}/lib
local cur prev cmd
local select_opts general_opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd="stop remove chown rename build validate version help system-start system-upgrade config import system-stop refresh move restart status select system-install duso list create history start cd"
general_opts="-v -e"
select_opts="-stage -all"
fail_opts="before after never"
case "${prev}" in
create)
if [[ ${cur} == -* ]] ; then
local option="-quiet -prefix -name "
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
return 0
fi
# url
return 0
;;
import)
if [[ ${cur} == -* ]] ; then
local option="-max"
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
return 0
else
COMPREPLY=( $(compgen -f "$2" ) )
return 0
fi
;;
select)
local stages=$(for dir in `ls -1 $lib/backstages/`; do echo ${dir}; done; echo 'none')
COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
return 0
;;
status)
local stages=$(for dir in `ls -1 $lib/backstages/`; do echo ${dir}; done)
COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
return 0
;;
stop)
if [[ ${cur} == -* ]] ; then
local option="-sleep -stail"
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
fi
;;
config)
compopt +o nospace &>/dev/null
local option="suffix until maven.opts sslUrl java.home tomcat.select tomcat.perm tomcat.heap tomcat.version tomcat.opts port.prefix build cookies pustefix.mode autoRefresh comment fitnesse pustefix.editor.version pustefix.editor.userdata pustefix.editor"
COMPREPLY=( $(compgen -o nospace -W "${option}" -- ${cur}) )
return 0
;;
restart)
if [[ ${cur} == -* ]] ; then
local option="-debug"
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
fi
;;
chown)
COMPREPLY=( $(compgen -W "$USER" -- ${cur}) )
return 0
;;
rename)
if [[ ${cur} == -* ]] ; then
local option="-force -batch"
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
return 0
fi
;;
remove)
if [[ ${cur} == -* ]] ; then
local option="-force -batch"
COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
return 0
fi
;;
cd)
local stages="backstage conf java jmx run tomcat conf logs temp work "
COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=( $(compgen -W "${cmd}" -- ${cur}) )
return 0
}
complete -F _stool_complete stool