This commit is contained in:
Félix Saparelli 2024-04-20 23:56:11 +12:00
parent 6f5f8a057a
commit 9d7f88b865
No known key found for this signature in database
9 changed files with 53 additions and 11 deletions

View File

@ -19,7 +19,7 @@ _watchexec() {
case "${cmd}" in case "${cmd}" in
watchexec) watchexec)
opts="-w -c -o -r -s -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --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 --notify --color --timings --quiet --bell --project-origin --workdir --exts --filter --filter-file --filter-prog --ignore --ignore-file --fs-events --no-meta --print-events --verbose --log-file --manual --completions --help --version [COMMAND]..." opts="-w -c -o -r -s -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --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 --verbose --log-file --manual --completions --help --version [COMMAND]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
@ -101,6 +101,10 @@ _watchexec() {
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
;; ;;
--wrap-process)
COMPREPLY=($(compgen -W "group session none" -- "${cur}"))
return 0
;;
--color) --color)
COMPREPLY=($(compgen -W "auto always never" -- "${cur}")) COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
return 0 return 0

View File

@ -37,6 +37,7 @@ set edit:completion:arg-completer[watchexec] = {|@words|
cand --emit-events-to 'Configure event emission' cand --emit-events-to 'Configure event emission'
cand -E 'Add env vars to the command' cand -E 'Add env vars to the command'
cand --env 'Add env vars to the command' cand --env 'Add env vars to the command'
cand --wrap-process 'Configure how the process is wrapped'
cand --color 'When to use terminal colours' cand --color 'When to use terminal colours'
cand --project-origin 'Set the project origin' cand --project-origin 'Set the project origin'
cand --workdir 'Set the working directory' cand --workdir 'Set the working directory'

View File

@ -11,6 +11,7 @@ complete -c watchexec -l poll -d 'Poll for filesystem changes' -r
complete -c watchexec -l shell -d 'Use a different shell' -r complete -c watchexec -l shell -d 'Use a different shell' -r
complete -c watchexec -l emit-events-to -d 'Configure event emission' -r -f -a "{environment '',stdio '',file '',json-stdio '',json-file '',none ''}" complete -c watchexec -l emit-events-to -d 'Configure event emission' -r -f -a "{environment '',stdio '',file '',json-stdio '',json-file '',none ''}"
complete -c watchexec -s E -l env -d 'Add env vars to the command' -r complete -c watchexec -s E -l env -d 'Add env vars to the command' -r
complete -c watchexec -l wrap-process -d 'Configure how the process is wrapped' -r -f -a "{group '',session '',none ''}"
complete -c watchexec -l color -d 'When to use terminal colours' -r -f -a "{auto '',always '',never ''}" complete -c watchexec -l color -d 'When to use terminal colours' -r -f -a "{auto '',always '',never ''}"
complete -c watchexec -l project-origin -d 'Set the project origin' -r -f -a "(__fish_complete_directories)" complete -c watchexec -l project-origin -d 'Set the project origin' -r -f -a "(__fish_complete_directories)"
complete -c watchexec -l workdir -d 'Set the working directory' -r -f -a "(__fish_complete_directories)" complete -c watchexec -l workdir -d 'Set the working directory' -r -f -a "(__fish_complete_directories)"

View File

@ -12,6 +12,10 @@ module completions {
[ "environment" "stdio" "file" "json-stdio" "json-file" "none" ] [ "environment" "stdio" "file" "json-stdio" "json-file" "none" ]
} }
def "nu-complete watchexec wrap_process" [] {
[ "group" "session" "none" ]
}
def "nu-complete watchexec color" [] { def "nu-complete watchexec color" [] {
[ "auto" "always" "never" ] [ "auto" "always" "never" ]
} }
@ -53,6 +57,7 @@ module completions {
--only-emit-events # Only emit events to stdout, run no commands --only-emit-events # Only emit events to stdout, run no commands
--env(-E): string # Add env vars to the command --env(-E): string # Add env vars to the command
--no-process-group # Don't use a process group --no-process-group # Don't use a process group
--wrap-process: string@"nu-complete watchexec wrap_process" # Configure how the process is wrapped
-1 # Testing only: exit Watchexec after the first run -1 # Testing only: exit Watchexec after the first run
--notify(-N) # Alert when commands start and end --notify(-N) # Alert when commands start and end
--color: string@"nu-complete watchexec color" # When to use terminal colours --color: string@"nu-complete watchexec color" # When to use terminal colours

View File

@ -40,6 +40,7 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
[CompletionResult]::new('--emit-events-to', 'emit-events-to', [CompletionResultType]::ParameterName, 'Configure event emission') [CompletionResult]::new('--emit-events-to', 'emit-events-to', [CompletionResultType]::ParameterName, 'Configure event emission')
[CompletionResult]::new('-E', 'E ', [CompletionResultType]::ParameterName, 'Add env vars to the command') [CompletionResult]::new('-E', 'E ', [CompletionResultType]::ParameterName, 'Add env vars to the command')
[CompletionResult]::new('--env', 'env', [CompletionResultType]::ParameterName, 'Add env vars to the command') [CompletionResult]::new('--env', 'env', [CompletionResultType]::ParameterName, 'Add env vars to the command')
[CompletionResult]::new('--wrap-process', 'wrap-process', [CompletionResultType]::ParameterName, 'Configure how the process is wrapped')
[CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'When to use terminal colours') [CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'When to use terminal colours')
[CompletionResult]::new('--project-origin', 'project-origin', [CompletionResultType]::ParameterName, 'Set the project origin') [CompletionResult]::new('--project-origin', 'project-origin', [CompletionResultType]::ParameterName, 'Set the project origin')
[CompletionResult]::new('--workdir', 'workdir', [CompletionResultType]::ParameterName, 'Set the working directory') [CompletionResult]::new('--workdir', 'workdir', [CompletionResultType]::ParameterName, 'Set the working directory')

View File

@ -34,6 +34,7 @@ _watchexec() {
'--emit-events-to=[Configure event emission]:MODE:(environment stdio file json-stdio json-file none)' \ '--emit-events-to=[Configure event emission]:MODE:(environment stdio file json-stdio json-file none)' \
'*-E+[Add env vars to the command]:KEY=VALUE: ' \ '*-E+[Add env vars to the command]:KEY=VALUE: ' \
'*--env=[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)' \ '--color=[When to use terminal colours]:MODE:(auto always never)' \
'--project-origin=[Set the project origin]:DIRECTORY:_files -/' \ '--project-origin=[Set the project origin]:DIRECTORY:_files -/' \
'--workdir=[Set the working directory]:DIRECTORY:_files -/' \ '--workdir=[Set the working directory]:DIRECTORY:_files -/' \

View File

@ -657,6 +657,7 @@ pub struct Args {
long, long,
help_heading = OPTSET_COMMAND, help_heading = OPTSET_COMMAND,
value_name = "MODE", value_name = "MODE",
default_value = "group",
)] )]
pub wrap_process: WrapMode, pub wrap_process: WrapMode,

View File

@ -4,7 +4,7 @@
.SH NAME .SH NAME
watchexec \- Execute commands when watched files change watchexec \- Execute commands when watched files change
.SH SYNOPSIS .SH SYNOPSIS
\fBwatchexec\fR [\fB\-w\fR|\fB\-\-watch\fR] [\fB\-c\fR|\fB\-\-clear\fR] [\fB\-o\fR|\fB\-\-on\-busy\-update\fR] [\fB\-r\fR|\fB\-\-restart\fR] [\fB\-s\fR|\fB\-\-signal\fR] [\fB\-\-stop\-signal\fR] [\fB\-\-stop\-timeout\fR] [\fB\-\-map\-signal\fR] [\fB\-d\fR|\fB\-\-debounce\fR] [\fB\-\-stdin\-quit\fR] [\fB\-\-no\-vcs\-ignore\fR] [\fB\-\-no\-project\-ignore\fR] [\fB\-\-no\-global\-ignore\fR] [\fB\-\-no\-default\-ignore\fR] [\fB\-\-no\-discover\-ignore\fR] [\fB\-\-ignore\-nothing\fR] [\fB\-p\fR|\fB\-\-postpone\fR] [\fB\-\-delay\-run\fR] [\fB\-\-poll\fR] [\fB\-\-shell\fR] [\fB\-n \fR] [\fB\-\-emit\-events\-to\fR] [\fB\-\-only\-emit\-events\fR] [\fB\-E\fR|\fB\-\-env\fR] [\fB\-\-no\-process\-group\fR] [\fB\-N\fR|\fB\-\-notify\fR] [\fB\-\-color\fR] [\fB\-\-timings\fR] [\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-\-bell\fR] [\fB\-\-project\-origin\fR] [\fB\-\-workdir\fR] [\fB\-e\fR|\fB\-\-exts\fR] [\fB\-f\fR|\fB\-\-filter\fR] [\fB\-\-filter\-file\fR] [\fB\-j\fR|\fB\-\-filter\-prog\fR] [\fB\-i\fR|\fB\-\-ignore\fR] [\fB\-\-ignore\-file\fR] [\fB\-\-fs\-events\fR] [\fB\-\-no\-meta\fR] [\fB\-\-print\-events\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-\-log\-file\fR] [\fB\-\-manual\fR] [\fB\-\-completions\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fICOMMAND\fR] \fBwatchexec\fR [\fB\-w\fR|\fB\-\-watch\fR] [\fB\-c\fR|\fB\-\-clear\fR] [\fB\-o\fR|\fB\-\-on\-busy\-update\fR] [\fB\-r\fR|\fB\-\-restart\fR] [\fB\-s\fR|\fB\-\-signal\fR] [\fB\-\-stop\-signal\fR] [\fB\-\-stop\-timeout\fR] [\fB\-\-map\-signal\fR] [\fB\-d\fR|\fB\-\-debounce\fR] [\fB\-\-stdin\-quit\fR] [\fB\-\-no\-vcs\-ignore\fR] [\fB\-\-no\-project\-ignore\fR] [\fB\-\-no\-global\-ignore\fR] [\fB\-\-no\-default\-ignore\fR] [\fB\-\-no\-discover\-ignore\fR] [\fB\-\-ignore\-nothing\fR] [\fB\-p\fR|\fB\-\-postpone\fR] [\fB\-\-delay\-run\fR] [\fB\-\-poll\fR] [\fB\-\-shell\fR] [\fB\-n \fR] [\fB\-\-emit\-events\-to\fR] [\fB\-\-only\-emit\-events\fR] [\fB\-E\fR|\fB\-\-env\fR] [\fB\-\-no\-process\-group\fR] [\fB\-\-wrap\-process\fR] [\fB\-N\fR|\fB\-\-notify\fR] [\fB\-\-color\fR] [\fB\-\-timings\fR] [\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-\-bell\fR] [\fB\-\-project\-origin\fR] [\fB\-\-workdir\fR] [\fB\-e\fR|\fB\-\-exts\fR] [\fB\-f\fR|\fB\-\-filter\fR] [\fB\-\-filter\-file\fR] [\fB\-j\fR|\fB\-\-filter\-prog\fR] [\fB\-i\fR|\fB\-\-ignore\fR] [\fB\-\-ignore\-file\fR] [\fB\-\-fs\-events\fR] [\fB\-\-no\-meta\fR] [\fB\-\-print\-events\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-\-log\-file\fR] [\fB\-\-manual\fR] [\fB\-\-completions\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fICOMMAND\fR]
.SH DESCRIPTION .SH DESCRIPTION
Execute commands when watched files change. Execute commands when watched files change.
.PP .PP
@ -370,6 +370,17 @@ Use key=value syntax. Multiple variables can be set by repeating the option.
Don\*(Aqt use a process group Don\*(Aqt use a process group
By default, Watchexec will run the command in a process group, so that signals and terminations are sent to all processes in the group. Sometimes that\*(Aqs not what you want, and you can disable the behaviour with this option. By default, Watchexec will run the command in a process group, so that signals and terminations are sent to all processes in the group. Sometimes that\*(Aqs not what you want, and you can disable the behaviour with this option.
Deprecated, use \*(Aq\-\-wrap\-process=none\*(Aq instead.
.TP
\fB\-\-wrap\-process\fR=\fIMODE\fR [default: group]
Configure how the process is wrapped
By default, Watchexec will run the command in a process group in Unix, and in a Job Object in Windows.
Some Unix programs prefer running in a session, while others do not work in a process group.
Use \*(Aqgroup\*(Aq to use a process group, \*(Aqsession\*(Aq to use a process session, and \*(Aqnone\*(Aq to run the command directly. On Windows, either of \*(Aqgroup\*(Aq or \*(Aqsession\*(Aq will use a Job Object.
.TP .TP
\fB\-N\fR, \fB\-\-notify\fR \fB\-N\fR, \fB\-\-notify\fR
Alert when commands start and end Alert when commands start and end

View File

@ -14,15 +14,16 @@ watchexec - Execute commands when watched files change
\[**-p**\|**\--postpone**\] \[**\--delay-run**\] \[**\--poll**\] \[**-p**\|**\--postpone**\] \[**\--delay-run**\] \[**\--poll**\]
\[**\--shell**\] \[**-n **\] \[**\--emit-events-to**\] \[**\--shell**\] \[**-n **\] \[**\--emit-events-to**\]
\[**\--only-emit-events**\] \[**-E**\|**\--env**\] \[**\--only-emit-events**\] \[**-E**\|**\--env**\]
\[**\--no-process-group**\] \[**-N**\|**\--notify**\] \[**\--color**\] \[**\--no-process-group**\] \[**\--wrap-process**\]
\[**\--timings**\] \[**-q**\|**\--quiet**\] \[**\--bell**\] \[**-N**\|**\--notify**\] \[**\--color**\] \[**\--timings**\]
\[**\--project-origin**\] \[**\--workdir**\] \[**-e**\|**\--exts**\] \[**-q**\|**\--quiet**\] \[**\--bell**\] \[**\--project-origin**\]
\[**-f**\|**\--filter**\] \[**\--filter-file**\] \[**\--workdir**\] \[**-e**\|**\--exts**\] \[**-f**\|**\--filter**\]
\[**-j**\|**\--filter-prog**\] \[**-i**\|**\--ignore**\] \[**\--filter-file**\] \[**-j**\|**\--filter-prog**\]
\[**\--ignore-file**\] \[**\--fs-events**\] \[**\--no-meta**\] \[**-i**\|**\--ignore**\] \[**\--ignore-file**\] \[**\--fs-events**\]
\[**\--print-events**\] \[**-v**\|**\--verbose**\]\... \[**\--no-meta**\] \[**\--print-events**\]
\[**\--log-file**\] \[**\--manual**\] \[**\--completions**\] \[**-v**\|**\--verbose**\]\... \[**\--log-file**\] \[**\--manual**\]
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\] \[*COMMAND*\] \[**\--completions**\] \[**-h**\|**\--help**\]
\[**-V**\|**\--version**\] \[*COMMAND*\]
# DESCRIPTION # DESCRIPTION
@ -518,6 +519,22 @@ signals and terminations are sent to all processes in the group.
Sometimes thats not what you want, and you can disable the behaviour Sometimes thats not what you want, and you can disable the behaviour
with this option. with this option.
Deprecated, use \--wrap-process=none instead.
**\--wrap-process**=*MODE* \[default: group\]
: Configure how the process is wrapped
By default, Watchexec will run the command in a process group in Unix,
and in a Job Object in Windows.
Some Unix programs prefer running in a session, while others do not work
in a process group.
Use group to use a process group, session to use a process session, and
none to run the command directly. On Windows, either of group or session
will use a Job Object.
**-N**, **\--notify** **-N**, **\--notify**
: Alert when commands start and end : Alert when commands start and end