mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-14 00:01:12 +01:00
Manpage and completions
This commit is contained in:
parent
510dd625d1
commit
b0125bc113
9 changed files with 58 additions and 11 deletions
|
@ -19,7 +19,7 @@ _watchexec() {
|
||||||
|
|
||||||
case "${cmd}" in
|
case "${cmd}" in
|
||||||
watchexec)
|
watchexec)
|
||||||
opts="-w -W -c -o -r -s -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --watch-non-recursive --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]..."
|
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]..."
|
||||||
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
|
||||||
|
@ -41,6 +41,14 @@ _watchexec() {
|
||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--watch-file)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-F)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
--clear)
|
--clear)
|
||||||
COMPREPLY=($(compgen -W "clear reset" -- "${cur}"))
|
COMPREPLY=($(compgen -W "clear reset" -- "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -22,6 +22,8 @@ set edit:completion:arg-completer[watchexec] = {|@words|
|
||||||
cand --watch 'Watch a specific file or directory'
|
cand --watch 'Watch a specific file or directory'
|
||||||
cand -W 'Watch a specific directory, non-recursively'
|
cand -W 'Watch a specific directory, non-recursively'
|
||||||
cand --watch-non-recursive 'Watch a specific directory, non-recursively'
|
cand --watch-non-recursive 'Watch a specific directory, non-recursively'
|
||||||
|
cand -F 'Watch files and directories from a file'
|
||||||
|
cand --watch-file 'Watch files and directories from a file'
|
||||||
cand -c 'Clear screen before running command'
|
cand -c 'Clear screen before running command'
|
||||||
cand --clear 'Clear screen before running command'
|
cand --clear 'Clear screen before running command'
|
||||||
cand -o 'What to do when receiving events while the command is running'
|
cand -o 'What to do when receiving events while the command is running'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
complete -c watchexec -s w -l watch -d 'Watch a specific file or directory' -r -F
|
complete -c watchexec -s w -l watch -d 'Watch a specific file or directory' -r -F
|
||||||
complete -c watchexec -s W -l watch-non-recursive -d 'Watch a specific directory, non-recursively' -r -F
|
complete -c watchexec -s W -l watch-non-recursive -d 'Watch a specific directory, non-recursively' -r -F
|
||||||
|
complete -c watchexec -s F -l watch-file -d 'Watch files and directories from a file' -r -F
|
||||||
complete -c watchexec -s c -l clear -d 'Clear screen before running command' -r -f -a "{clear '',reset ''}"
|
complete -c watchexec -s c -l clear -d 'Clear screen before running command' -r -f -a "{clear '',reset ''}"
|
||||||
complete -c watchexec -s o -l on-busy-update -d 'What to do when receiving events while the command is running' -r -f -a "{queue '',do-nothing '',restart '',signal ''}"
|
complete -c watchexec -s o -l on-busy-update -d 'What to do when receiving events while the command is running' -r -f -a "{queue '',do-nothing '',restart '',signal ''}"
|
||||||
complete -c watchexec -s s -l signal -d 'Send a signal to the process when it\'s still running' -r
|
complete -c watchexec -s s -l signal -d 'Send a signal to the process when it\'s still running' -r
|
||||||
|
|
|
@ -33,6 +33,7 @@ module completions {
|
||||||
...command: string # Command to run on changes
|
...command: string # Command to run on changes
|
||||||
--watch(-w): string # Watch a specific file or directory
|
--watch(-w): string # Watch a specific file or directory
|
||||||
--watch-non-recursive(-W): string # Watch a specific directory, non-recursively
|
--watch-non-recursive(-W): string # Watch a specific directory, non-recursively
|
||||||
|
--watch-file(-F): string # Watch files and directories from a file
|
||||||
--clear(-c): string@"nu-complete watchexec screen_clear" # Clear screen before running command
|
--clear(-c): string@"nu-complete watchexec screen_clear" # Clear screen before running command
|
||||||
--on-busy-update(-o): string@"nu-complete watchexec on_busy_update" # What to do when receiving events while the command is running
|
--on-busy-update(-o): string@"nu-complete watchexec on_busy_update" # What to do when receiving events while the command is running
|
||||||
--restart(-r) # Restart the process if it's still running
|
--restart(-r) # Restart the process if it's still running
|
||||||
|
|
|
@ -25,6 +25,8 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
|
||||||
[CompletionResult]::new('--watch', 'watch', [CompletionResultType]::ParameterName, 'Watch a specific file or directory')
|
[CompletionResult]::new('--watch', 'watch', [CompletionResultType]::ParameterName, 'Watch a specific file or directory')
|
||||||
[CompletionResult]::new('-W', 'W ', [CompletionResultType]::ParameterName, 'Watch a specific directory, non-recursively')
|
[CompletionResult]::new('-W', 'W ', [CompletionResultType]::ParameterName, 'Watch a specific directory, non-recursively')
|
||||||
[CompletionResult]::new('--watch-non-recursive', 'watch-non-recursive', [CompletionResultType]::ParameterName, 'Watch a specific directory, non-recursively')
|
[CompletionResult]::new('--watch-non-recursive', 'watch-non-recursive', [CompletionResultType]::ParameterName, 'Watch a specific directory, non-recursively')
|
||||||
|
[CompletionResult]::new('-F', 'F ', [CompletionResultType]::ParameterName, 'Watch files and directories from a file')
|
||||||
|
[CompletionResult]::new('--watch-file', 'watch-file', [CompletionResultType]::ParameterName, 'Watch files and directories from a file')
|
||||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Clear screen before running command')
|
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Clear screen before running command')
|
||||||
[CompletionResult]::new('--clear', 'clear', [CompletionResultType]::ParameterName, 'Clear screen before running command')
|
[CompletionResult]::new('--clear', 'clear', [CompletionResultType]::ParameterName, 'Clear screen before running command')
|
||||||
[CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'What to do when receiving events while the command is running')
|
[CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'What to do when receiving events while the command is running')
|
||||||
|
|
|
@ -19,6 +19,8 @@ _watchexec() {
|
||||||
'*--watch=[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' \
|
'*-W+[Watch a specific directory, non-recursively]:PATH:_files' \
|
||||||
'*--watch-non-recursive=[Watch a specific directory, non-recursively]:PATH:_files' \
|
'*--watch-non-recursive=[Watch a specific directory, non-recursively]:PATH:_files' \
|
||||||
|
'-F+[Watch files and directories from a file]:PATH:_files' \
|
||||||
|
'--watch-file=[Watch files and directories from a file]:PATH:_files' \
|
||||||
'-c+[Clear screen before running command]' \
|
'-c+[Clear screen before running command]' \
|
||||||
'--clear=[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)' \
|
'-o+[What to do when receiving events while the command is running]:MODE:(queue do-nothing restart signal)' \
|
||||||
|
|
|
@ -1263,11 +1263,19 @@ pub async fn get_args() -> Result<(Args, Option<WorkerGuard>)> {
|
||||||
args.project_origin = Some(project_origin.clone());
|
args.project_origin = Some(project_origin.clone());
|
||||||
|
|
||||||
if let Some(watch_file) = args.watch_file.as_ref() {
|
if let Some(watch_file) = args.watch_file.as_ref() {
|
||||||
let file = BufReader::new(File::open(watch_file).await.into_diagnostic()?);
|
if watch_file == Path::new("-") {
|
||||||
let mut lines = file.lines();
|
let file = tokio::io::stdin();
|
||||||
while let Ok(Some(line)) = lines.next_line().await {
|
let mut lines = BufReader::new(file).lines();
|
||||||
args.recursive_paths.push(line.into());
|
while let Ok(Some(line)) = lines.next_line().await {
|
||||||
}
|
args.recursive_paths.push(line.into());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let file = File::open(watch_file).await.into_diagnostic()?;
|
||||||
|
let mut lines = BufReader::new(file).lines();
|
||||||
|
while let Ok(Some(line)) = lines.next_line().await {
|
||||||
|
args.recursive_paths.push(line.into());
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
args.paths = take(&mut args.recursive_paths)
|
args.paths = take(&mut args.recursive_paths)
|
||||||
|
|
|
@ -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\-W\fR|\fB\-\-watch\-non\-recursive\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\-\-manual\fR] [\fB\-\-completions\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-\-log\-file\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fICOMMAND\fR]
|
\fBwatchexec\fR [\fB\-w\fR|\fB\-\-watch\fR] [\fB\-W\fR|\fB\-\-watch\-non\-recursive\fR] [\fB\-F\fR|\fB\-\-watch\-file\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\-\-manual\fR] [\fB\-\-completions\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-\-log\-file\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
|
||||||
|
@ -55,6 +55,15 @@ Unlike \*(Aq\-w\*(Aq, folders watched with this option are not recursed into.
|
||||||
|
|
||||||
This option can be specified multiple times to watch multiple directories non\-recursively.
|
This option can be specified multiple times to watch multiple directories non\-recursively.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-F\fR, \fB\-\-watch\-file\fR=\fIPATH\fR
|
||||||
|
Watch files and directories from a file
|
||||||
|
|
||||||
|
Each line in the file will be interpreted as if given to \*(Aq\-w\*(Aq.
|
||||||
|
|
||||||
|
For more complex uses (like watching non\-recursively), use the argfile capability: build a file containing command\-line options and pass it to watchexec with `@path/to/argfile`.
|
||||||
|
|
||||||
|
The special value \*(Aq\-\*(Aq will read from STDIN; this in incompatible with \*(Aq\-\-stdin\-quit\*(Aq.
|
||||||
|
.TP
|
||||||
\fB\-c\fR, \fB\-\-clear\fR=\fIMODE\fR
|
\fB\-c\fR, \fB\-\-clear\fR=\fIMODE\fR
|
||||||
Clear screen before running command
|
Clear screen before running command
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,11 @@ watchexec - Execute commands when watched files change
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**watchexec** \[**-w**\|**\--watch**\]
|
**watchexec** \[**-w**\|**\--watch**\]
|
||||||
\[**-W**\|**\--watch-non-recursive**\] \[**-c**\|**\--clear**\]
|
\[**-W**\|**\--watch-non-recursive**\] \[**-F**\|**\--watch-file**\]
|
||||||
\[**-o**\|**\--on-busy-update**\] \[**-r**\|**\--restart**\]
|
\[**-c**\|**\--clear**\] \[**-o**\|**\--on-busy-update**\]
|
||||||
\[**-s**\|**\--signal**\] \[**\--stop-signal**\] \[**\--stop-timeout**\]
|
\[**-r**\|**\--restart**\] \[**-s**\|**\--signal**\]
|
||||||
\[**\--map-signal**\] \[**-d**\|**\--debounce**\] \[**\--stdin-quit**\]
|
\[**\--stop-signal**\] \[**\--stop-timeout**\] \[**\--map-signal**\]
|
||||||
|
\[**-d**\|**\--debounce**\] \[**\--stdin-quit**\]
|
||||||
\[**\--no-vcs-ignore**\] \[**\--no-project-ignore**\]
|
\[**\--no-vcs-ignore**\] \[**\--no-project-ignore**\]
|
||||||
\[**\--no-global-ignore**\] \[**\--no-default-ignore**\]
|
\[**\--no-global-ignore**\] \[**\--no-default-ignore**\]
|
||||||
\[**\--no-discover-ignore**\] \[**\--ignore-nothing**\]
|
\[**\--no-discover-ignore**\] \[**\--ignore-nothing**\]
|
||||||
|
@ -92,6 +93,19 @@ Unlike -w, folders watched with this option are not recursed into.
|
||||||
This option can be specified multiple times to watch multiple
|
This option can be specified multiple times to watch multiple
|
||||||
directories non-recursively.
|
directories non-recursively.
|
||||||
|
|
||||||
|
**-F**, **\--watch-file**=*PATH*
|
||||||
|
|
||||||
|
: Watch files and directories from a file
|
||||||
|
|
||||||
|
Each line in the file will be interpreted as if given to -w.
|
||||||
|
|
||||||
|
For more complex uses (like watching non-recursively), use the argfile
|
||||||
|
capability: build a file containing command-line options and pass it to
|
||||||
|
watchexec with \`@path/to/argfile\`.
|
||||||
|
|
||||||
|
The special value - will read from STDIN; this in incompatible with
|
||||||
|
\--stdin-quit.
|
||||||
|
|
||||||
**-c**, **\--clear**=*MODE*
|
**-c**, **\--clear**=*MODE*
|
||||||
|
|
||||||
: Clear screen before running command
|
: Clear screen before running command
|
||||||
|
|
Loading…
Reference in a new issue