2017-12-29 18:25:06 +00:00
|
|
|
_gutenberg() {
|
|
|
|
local i cur prev opts cmds
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
cmd=""
|
|
|
|
opts=""
|
|
|
|
|
|
|
|
for i in ${COMP_WORDS[@]}
|
|
|
|
do
|
|
|
|
case "${i}" in
|
|
|
|
gutenberg)
|
|
|
|
cmd="gutenberg"
|
|
|
|
;;
|
|
|
|
|
|
|
|
build)
|
|
|
|
cmd+="__build"
|
|
|
|
;;
|
|
|
|
help)
|
|
|
|
cmd+="__help"
|
|
|
|
;;
|
|
|
|
init)
|
|
|
|
cmd+="__init"
|
|
|
|
;;
|
|
|
|
serve)
|
|
|
|
cmd+="__serve"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${cmd}" in
|
|
|
|
gutenberg)
|
2018-03-16 18:11:08 +00:00
|
|
|
opts=" -h -V -c --help --version --config init build serve help"
|
2017-12-29 18:25:06 +00:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
|
2018-03-16 18:11:08 +00:00
|
|
|
--config)
|
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-c)
|
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
|
|
|
return 0
|
|
|
|
;;
|
2017-12-29 18:25:06 +00:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
gutenberg__build)
|
|
|
|
opts=" -h -V -u -o --help --version --base-url --output-dir "
|
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
|
|
|
|
--base-url)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-u)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--output-dir)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-o)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
gutenberg__help)
|
|
|
|
opts=" -h -V --help --version "
|
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
|
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
gutenberg__init)
|
|
|
|
opts=" -h -V --help --version <name> "
|
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
|
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
gutenberg__serve)
|
2018-02-02 16:37:30 +00:00
|
|
|
opts=" -h -V -i -p -o -u --help --version --interface --port --output-dir --base-url "
|
2017-12-29 18:25:06 +00:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
|
|
|
|
--interface)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-i)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--port)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-p)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--output-dir)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-o)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2017-12-29 18:25:06 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2018-02-02 16:37:30 +00:00
|
|
|
--base-url)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2018-02-02 16:37:30 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-u)
|
2018-03-16 18:11:08 +00:00
|
|
|
COMPREPLY=($(compgen -f ${cur}))
|
2018-02-02 16:37:30 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2017-12-29 18:25:06 +00:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _gutenberg -o bashdefault -o default gutenberg
|