mirror of https://github.com/passcod/cargo-watch
137 lines
4.2 KiB
Bash
137 lines
4.2 KiB
Bash
_cargo-watch() {
|
|
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
|
|
"$1")
|
|
cmd="cargo__watch"
|
|
;;
|
|
help)
|
|
cmd+="__help"
|
|
;;
|
|
watch)
|
|
cmd+="__watch"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
done
|
|
|
|
case "${cmd}" in
|
|
cargo__watch)
|
|
opts="-h -V --help --version watch help"
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
return 0
|
|
fi
|
|
case "${prev}" in
|
|
*)
|
|
COMPREPLY=()
|
|
;;
|
|
esac
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
return 0
|
|
;;
|
|
cargo__watch__help)
|
|
opts="<SUBCOMMAND>..."
|
|
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
|
|
;;
|
|
cargo__watch__watch)
|
|
opts="-c -q -x -s -d -i -p -w -C -N -B -L -h -V --testing-only--once --clear --debug --why --ignore-nothing --no-gitignore --no-ignore --no-restart --all --poll --postpone --features --quiet --exec --shell --delay --ignore --package --watch --use-shell --workdir --notify --help --version <trailing command>..."
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
return 0
|
|
fi
|
|
case "${prev}" in
|
|
--features)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--exec)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-x)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--shell)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-s)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--delay)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-d)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--ignore)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-i)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--package)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-p)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--watch)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-w)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--use-shell)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
--workdir)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
-C)
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
return 0
|
|
;;
|
|
*)
|
|
COMPREPLY=()
|
|
;;
|
|
esac
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
return 0
|
|
;;
|
|
esac
|
|
}
|
|
|
|
complete -F _cargo-watch -o bashdefault -o default cargo-watch
|