mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-07 20:11:29 +02:00
101 lines
4.9 KiB
Plaintext
101 lines
4.9 KiB
Plaintext
#compdef watchexec
|
|
|
|
autoload -U is-at-least
|
|
|
|
_watchexec() {
|
|
typeset -A opt_args
|
|
typeset -a _arguments_options
|
|
local ret=1
|
|
|
|
if is-at-least 5.2; then
|
|
_arguments_options=(-s -S -C)
|
|
else
|
|
_arguments_options=(-s -C)
|
|
fi
|
|
|
|
local context curcontext="$curcontext" state line
|
|
_arguments "${_arguments_options[@]}" \
|
|
'*-w+[Watch a specific file or directory]:PATH:_files' \
|
|
'*--watch=[Watch a specific file or directory]:PATH:_files' \
|
|
'-c+[Clear screen before running command]' \
|
|
'--clear=[Clear screen before running command]' \
|
|
'-o+[What to do when receiving events while the command is running]:MODE:(queue do-nothing restart signal)' \
|
|
'--on-busy-update=[What to do when receiving events while the command is running]:MODE:(queue do-nothing restart signal)' \
|
|
'(-r --restart -W --watch-when-idle)-s+[Send a signal to the process when it'\''s still running]:SIGNAL: ' \
|
|
'(-r --restart -W --watch-when-idle)--signal=[Send a signal to the process when it'\''s still running]:SIGNAL: ' \
|
|
'--stop-signal=[Signal to send to stop the command]:SIGNAL: ' \
|
|
'--stop-timeout=[Time to wait for the command to exit gracefully]:TIMEOUT: ' \
|
|
'-d+[Time to wait for new events before taking action]:TIMEOUT: ' \
|
|
'--debounce=[Time to wait for new events before taking action]:TIMEOUT: ' \
|
|
'--delay-run=[Sleep before running the command]:DURATION: ' \
|
|
'--poll=[Poll for filesystem changes]' \
|
|
'--shell=[Use a different shell]:SHELL: ' \
|
|
'--emit-events-to=[Configure event emission]:MODE:(environment stdio file json-stdio json-file none)' \
|
|
'*-E+[Add env vars to the command]:KEY=VALUE: ' \
|
|
'*--env=[Add env vars to the command]:KEY=VALUE: ' \
|
|
'--color=[When to use terminal colours]:MODE:(auto always never)' \
|
|
'--project-origin=[Set the project origin]:DIRECTORY:_files -/' \
|
|
'--workdir=[Set the working directory]:DIRECTORY:_files -/' \
|
|
'*-e+[Filename extensions to filter to]:EXTENSIONS: ' \
|
|
'*--exts=[Filename extensions to filter to]:EXTENSIONS: ' \
|
|
'*-f+[Filename patterns to filter to]:PATTERN: ' \
|
|
'*--filter=[Filename patterns to filter to]:PATTERN: ' \
|
|
'*--filter-file=[Files to load filters from]:PATH:_files' \
|
|
'*-i+[Filename patterns to filter out]:PATTERN: ' \
|
|
'*--ignore=[Filename patterns to filter out]:PATTERN: ' \
|
|
'*--ignore-file=[Files to load ignores from]:PATH:_files' \
|
|
'*--fs-events=[Filesystem events to filter to]:EVENTS:(access create remove rename modify metadata)' \
|
|
'--log-file=[Write diagnostic logs to a file]' \
|
|
'(--manual)--completions=[Generate a shell completions script]:COMPLETIONS:(bash elvish fish nu powershell zsh)' \
|
|
'(-o --on-busy-update -r --restart)-W[Deprecated alias for '\''--on-busy-update=do-nothing'\'']' \
|
|
'(-o --on-busy-update -r --restart)--watch-when-idle[Deprecated alias for '\''--on-busy-update=do-nothing'\'']' \
|
|
'(-o --on-busy-update -W --watch-when-idle)-r[Restart the process if it'\''s still running]' \
|
|
'(-o --on-busy-update -W --watch-when-idle)--restart[Restart the process if it'\''s still running]' \
|
|
'-k[Hidden legacy shorthand for '\''--signal=kill'\'']' \
|
|
'--kill[Hidden legacy shorthand for '\''--signal=kill'\'']' \
|
|
'--stdin-quit[Exit when stdin closes]' \
|
|
'--no-vcs-ignore[Don'\''t load gitignores]' \
|
|
'--no-project-ignore[Don'\''t load project-local ignores]' \
|
|
'--no-global-ignore[Don'\''t load global ignores]' \
|
|
'--no-default-ignore[Don'\''t use internal default ignores]' \
|
|
'--no-discover-ignore[Don'\''t discover ignore files at all]' \
|
|
'--ignore-nothing[Don'\''t ignore anything at all]' \
|
|
'-p[Wait until first change before running command]' \
|
|
'--postpone[Wait until first change before running command]' \
|
|
'-n[Don'\''t use a shell]' \
|
|
'--no-shell-long[Don'\''t use a shell]' \
|
|
'--no-environment[Shorthand for '\''--emit-events=none'\'']' \
|
|
'(--completions --manual)--only-emit-events[Only emit events to stdout, run no commands]' \
|
|
'--no-process-group[Don'\''t use a process group]' \
|
|
'-1[Testing only\: exit Watchexec after the first run]' \
|
|
'-N[Alert when commands start and end]' \
|
|
'--notify[Alert when commands start and end]' \
|
|
'--timings[Print how long the command took to run]' \
|
|
'-q[Don'\''t print starting and stopping messages]' \
|
|
'--quiet[Don'\''t print starting and stopping messages]' \
|
|
'--bell[Ring the terminal bell on command completion]' \
|
|
'(--fs-events)--no-meta[Don'\''t emit fs events for metadata changes]' \
|
|
'--print-events[Print events that trigger actions]' \
|
|
'*-v[Set diagnostic log level]' \
|
|
'*--verbose[Set diagnostic log level]' \
|
|
'(--completions)--manual[Show the manual page]' \
|
|
'-h[Print help (see more with '\''--help'\'')]' \
|
|
'--help[Print help (see more with '\''--help'\'')]' \
|
|
'-V[Print version]' \
|
|
'--version[Print version]' \
|
|
'*::command -- Command to run on changes:_cmdstring' \
|
|
&& ret=0
|
|
}
|
|
|
|
(( $+functions[_watchexec_commands] )) ||
|
|
_watchexec_commands() {
|
|
local commands; commands=()
|
|
_describe -t commands 'watchexec commands' commands "$@"
|
|
}
|
|
|
|
if [ "$funcstack[1]" = "_watchexec" ]; then
|
|
_watchexec "$@"
|
|
else
|
|
compdef _watchexec watchexec
|
|
fi
|