#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' \ '*-W+[Watch a specific directory, non-recursively]:PATH:_files' \ '*--watch-non-recursive=[Watch a specific directory, non-recursively]: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)-s+[Send a signal to the process when it'\''s still running]:SIGNAL: ' \ '(-r --restart)--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: ' \ '*--map-signal=[Translate signals from the OS to signals to send to the command]:SIGNAL:SIGNAL: ' \ '-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: ' \ '--wrap-process=[Configure how the process is wrapped]:MODE:(group session none)' \ '--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' \ '*-j+[\[experimental\] Filter programs]:EXPRESSION: ' \ '*--filter-prog=[\[experimental\] Filter programs]:EXPRESSION: ' \ '*-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)' \ '(--manual)--completions=[Generate a shell completions script]:COMPLETIONS:(bash elvish fish nu powershell zsh)' \ '--log-file=[Write diagnostic logs to a file]' \ '(-o --on-busy-update)-r[Restart the process if it'\''s still running]' \ '(-o --on-busy-update)--restart[Restart the process if it'\''s still running]' \ '--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[Shorthand for '\''--shell=none'\'']' \ '--no-environment[Deprecated 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]' \ '(--completions)--manual[Show the manual page]' \ '*-v[Set diagnostic log level]' \ '*--verbose[Set diagnostic log level]' \ '-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