2023-03-05 02:57:34 +01:00
|
|
|
_watchexec() {
|
|
|
|
local i cur prev opts cmd
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
cmd=""
|
|
|
|
opts=""
|
|
|
|
|
|
|
|
for i in ${COMP_WORDS[@]}
|
|
|
|
do
|
|
|
|
case "${cmd},${i}" in
|
|
|
|
",$1")
|
|
|
|
cmd="watchexec"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${cmd}" in
|
|
|
|
watchexec)
|
2024-06-29 05:09:18 +02:00
|
|
|
opts="-w -W -F -c -o -r -s -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --watch-non-recursive --watch-file --clear --on-busy-update --restart --signal --stop-signal --stop-timeout --map-signal --debounce --stdin-quit --no-vcs-ignore --no-project-ignore --no-global-ignore --no-default-ignore --no-discover-ignore --ignore-nothing --postpone --delay-run --poll --shell --no-environment --emit-events-to --only-emit-events --env --no-process-group --wrap-process --notify --color --timings --quiet --bell --project-origin --workdir --exts --filter --filter-file --filter-prog --ignore --ignore-file --fs-events --no-meta --print-events --manual --completions --verbose --log-file --help --version [COMMAND]..."
|
2023-03-05 02:57:34 +01:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
--watch)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-w)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2024-04-28 08:33:07 +02:00
|
|
|
--watch-non-recursive)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-W)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2024-06-29 05:09:18 +02:00
|
|
|
--watch-file)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-F)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
--clear)
|
|
|
|
COMPREPLY=($(compgen -W "clear reset" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-c)
|
|
|
|
COMPREPLY=($(compgen -W "clear reset" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--on-busy-update)
|
|
|
|
COMPREPLY=($(compgen -W "queue do-nothing restart signal" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-o)
|
|
|
|
COMPREPLY=($(compgen -W "queue do-nothing restart signal" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--signal)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--stop-signal)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--stop-timeout)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-12-09 10:30:58 +01:00
|
|
|
--map-signal)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
--debounce)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-08-30 06:04:53 +02:00
|
|
|
-d)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
--delay-run)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--poll)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--shell)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--emit-events-to)
|
2023-11-28 12:30:33 +01:00
|
|
|
COMPREPLY=($(compgen -W "environment stdio file json-stdio json-file none" -- "${cur}"))
|
2023-03-05 02:57:34 +01:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--env)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-E)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2024-04-20 14:39:28 +02:00
|
|
|
--wrap-process)
|
|
|
|
COMPREPLY=($(compgen -W "group session none" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-11-27 13:12:51 +01:00
|
|
|
--color)
|
|
|
|
COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
--project-origin)
|
2024-04-20 07:45:50 +02:00
|
|
|
COMPREPLY=()
|
|
|
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
|
|
compopt -o plusdirs
|
|
|
|
fi
|
2023-03-05 02:57:34 +01:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--workdir)
|
2024-04-20 07:45:50 +02:00
|
|
|
COMPREPLY=()
|
|
|
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
|
|
compopt -o plusdirs
|
|
|
|
fi
|
2023-03-05 02:57:34 +01:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--exts)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-e)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--filter)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-f)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--filter-file)
|
2024-04-20 07:45:50 +02:00
|
|
|
local oldifs
|
|
|
|
if [ -n "${IFS+x}" ]; then
|
|
|
|
oldifs="$IFS"
|
|
|
|
fi
|
|
|
|
IFS=$'\n'
|
2023-03-05 02:57:34 +01:00
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
2024-04-20 07:45:50 +02:00
|
|
|
if [ -n "${oldifs+x}" ]; then
|
|
|
|
IFS="$oldifs"
|
|
|
|
fi
|
|
|
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
|
|
compopt -o filenames
|
|
|
|
fi
|
2023-03-05 02:57:34 +01:00
|
|
|
return 0
|
|
|
|
;;
|
2024-04-20 12:06:53 +02:00
|
|
|
--filter-prog)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-j)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
--ignore)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-i)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--ignore-file)
|
2024-04-20 07:45:50 +02:00
|
|
|
local oldifs
|
|
|
|
if [ -n "${IFS+x}" ]; then
|
|
|
|
oldifs="$IFS"
|
|
|
|
fi
|
|
|
|
IFS=$'\n'
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
if [ -n "${oldifs+x}" ]; then
|
|
|
|
IFS="$oldifs"
|
|
|
|
fi
|
|
|
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
|
|
compopt -o filenames
|
|
|
|
fi
|
2023-03-05 02:57:34 +01:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--fs-events)
|
|
|
|
COMPREPLY=($(compgen -W "access create remove rename modify metadata" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--completions)
|
|
|
|
COMPREPLY=($(compgen -W "bash elvish fish nu powershell zsh" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2024-04-28 08:33:07 +02:00
|
|
|
--log-file)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2023-03-05 02:57:34 +01:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2024-01-04 10:32:47 +01:00
|
|
|
if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
|
|
|
|
complete -F _watchexec -o nosort -o bashdefault -o default watchexec
|
|
|
|
else
|
|
|
|
complete -F _watchexec -o bashdefault -o default watchexec
|
|
|
|
fi
|