Breaking changes for --on-busy-update (#818)
This commit is contained in:
parent
317221584a
commit
e505a9ad05
|
@ -19,7 +19,7 @@ _watchexec() {
|
|||
|
||||
case "${cmd}" in
|
||||
watchexec)
|
||||
opts="-w -c -o -W -r -s -k -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --clear --on-busy-update --watch-when-idle --restart --signal --kill --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 -k -d -p -n -E -1 -N -q -e -f -j -i -v -h -V --watch --clear --on-busy-update --restart --signal --kill --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]..."
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
|
|
|
@ -53,8 +53,6 @@ set edit:completion:arg-completer[watchexec] = {|@words|
|
|||
cand --fs-events 'Filesystem events to filter to'
|
||||
cand --log-file 'Write diagnostic logs to a file'
|
||||
cand --completions 'Generate a shell completions script'
|
||||
cand -W 'Deprecated alias for ''--on-busy-update=do-nothing'''
|
||||
cand --watch-when-idle 'Deprecated alias for ''--on-busy-update=do-nothing'''
|
||||
cand -r 'Restart the process if it''s still running'
|
||||
cand --restart 'Restart the process if it''s still running'
|
||||
cand -k 'Hidden legacy shorthand for ''--signal=kill'''
|
||||
|
|
|
@ -23,7 +23,6 @@ complete -c watchexec -l ignore-file -d 'Files to load ignores from' -r -F
|
|||
complete -c watchexec -l fs-events -d 'Filesystem events to filter to' -r -f -a "{access '',create '',remove '',rename '',modify '',metadata ''}"
|
||||
complete -c watchexec -l log-file -d 'Write diagnostic logs to a file' -r -F
|
||||
complete -c watchexec -l completions -d 'Generate a shell completions script' -r -f -a "{bash '',elvish '',fish '',nu '',powershell '',zsh ''}"
|
||||
complete -c watchexec -s W -l watch-when-idle -d 'Deprecated alias for \'--on-busy-update=do-nothing\''
|
||||
complete -c watchexec -s r -l restart -d 'Restart the process if it\'s still running'
|
||||
complete -c watchexec -s k -l kill -d 'Hidden legacy shorthand for \'--signal=kill\''
|
||||
complete -c watchexec -l stdin-quit -d 'Exit when stdin closes'
|
||||
|
|
|
@ -30,7 +30,6 @@ module completions {
|
|||
--watch(-w): string # Watch a specific file or directory
|
||||
--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
|
||||
--watch-when-idle(-W) # Deprecated alias for '--on-busy-update=do-nothing'
|
||||
--restart(-r) # Restart the process if it's still running
|
||||
--signal(-s): string # Send a signal to the process when it's still running
|
||||
--kill(-k) # Hidden legacy shorthand for '--signal=kill'
|
||||
|
|
|
@ -56,8 +56,6 @@ Register-ArgumentCompleter -Native -CommandName 'watchexec' -ScriptBlock {
|
|||
[CompletionResult]::new('--fs-events', 'fs-events', [CompletionResultType]::ParameterName, 'Filesystem events to filter to')
|
||||
[CompletionResult]::new('--log-file', 'log-file', [CompletionResultType]::ParameterName, 'Write diagnostic logs to a file')
|
||||
[CompletionResult]::new('--completions', 'completions', [CompletionResultType]::ParameterName, 'Generate a shell completions script')
|
||||
[CompletionResult]::new('-W', 'W ', [CompletionResultType]::ParameterName, 'Deprecated alias for ''--on-busy-update=do-nothing''')
|
||||
[CompletionResult]::new('--watch-when-idle', 'watch-when-idle', [CompletionResultType]::ParameterName, 'Deprecated alias for ''--on-busy-update=do-nothing''')
|
||||
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Restart the process if it''s still running')
|
||||
[CompletionResult]::new('--restart', 'restart', [CompletionResultType]::ParameterName, 'Restart the process if it''s still running')
|
||||
[CompletionResult]::new('-k', 'k', [CompletionResultType]::ParameterName, 'Hidden legacy shorthand for ''--signal=kill''')
|
||||
|
|
|
@ -21,8 +21,8 @@ _watchexec() {
|
|||
'--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: ' \
|
||||
'(-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: ' \
|
||||
|
@ -50,10 +50,8 @@ _watchexec() {
|
|||
'*--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]' \
|
||||
'(-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]' \
|
||||
'-k[Hidden legacy shorthand for '\''--signal=kill'\'']' \
|
||||
'--kill[Hidden legacy shorthand for '\''--signal=kill'\'']' \
|
||||
'--stdin-quit[Exit when stdin closes]' \
|
||||
|
|
|
@ -159,30 +159,19 @@ pub struct Args {
|
|||
#[arg(
|
||||
short,
|
||||
long,
|
||||
default_value = "queue",
|
||||
default_value = "do-nothing",
|
||||
hide_default_value = true,
|
||||
value_name = "MODE"
|
||||
)]
|
||||
pub on_busy_update: OnBusyUpdate,
|
||||
|
||||
/// Deprecated alias for '--on-busy-update=do-nothing'
|
||||
///
|
||||
/// This option is deprecated and will be removed in the next major release.
|
||||
#[arg(
|
||||
long,
|
||||
short = 'W',
|
||||
hide = true,
|
||||
conflicts_with_all = ["on_busy_update", "restart"],
|
||||
)]
|
||||
pub watch_when_idle: bool,
|
||||
|
||||
/// Restart the process if it's still running
|
||||
///
|
||||
/// This is a shorthand for '--on-busy-update=restart'.
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
conflicts_with_all = ["on_busy_update", "watch_when_idle"],
|
||||
conflicts_with_all = ["on_busy_update"],
|
||||
)]
|
||||
pub restart: bool,
|
||||
|
||||
|
@ -199,7 +188,7 @@ pub struct Args {
|
|||
#[arg(
|
||||
short,
|
||||
long,
|
||||
conflicts_with_all = ["restart", "watch_when_idle"],
|
||||
conflicts_with_all = ["restart"],
|
||||
value_name = "SIGNAL"
|
||||
)]
|
||||
pub signal: Option<Signal>,
|
||||
|
@ -1191,8 +1180,6 @@ pub async fn get_args() -> Result<Args> {
|
|||
args.on_busy_update = OnBusyUpdate::Signal;
|
||||
} else if args.restart {
|
||||
args.on_busy_update = OnBusyUpdate::Restart;
|
||||
} else if args.watch_when_idle {
|
||||
args.on_busy_update = OnBusyUpdate::DoNothing;
|
||||
}
|
||||
|
||||
if args.no_environment {
|
||||
|
|
Loading…
Reference in New Issue