From e505a9ad059a2cf918c57415c7305e6f75452abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Saparelli?= Date: Sat, 20 Apr 2024 23:15:25 +1200 Subject: [PATCH] Breaking changes for --on-busy-update (#818) --- completions/bash | 2 +- completions/elvish | 2 -- completions/fish | 1 - completions/nu | 1 - completions/powershell | 2 -- completions/zsh | 10 ++++------ crates/cli/src/args.rs | 19 +++---------------- 7 files changed, 8 insertions(+), 29 deletions(-) diff --git a/completions/bash b/completions/bash index 197d95c..6c73319 100644 --- a/completions/bash +++ b/completions/bash @@ -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 diff --git a/completions/elvish b/completions/elvish index 109f8a7..4faa17b 100644 --- a/completions/elvish +++ b/completions/elvish @@ -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''' diff --git a/completions/fish b/completions/fish index dcf96d9..81fc250 100644 --- a/completions/fish +++ b/completions/fish @@ -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' diff --git a/completions/nu b/completions/nu index 98b65ea..6c577ce 100644 --- a/completions/nu +++ b/completions/nu @@ -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' diff --git a/completions/powershell b/completions/powershell index 9772f95..330890c 100644 --- a/completions/powershell +++ b/completions/powershell @@ -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''') diff --git a/completions/zsh b/completions/zsh index b8b0a79..71be820 100644 --- a/completions/zsh +++ b/completions/zsh @@ -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]' \ diff --git a/crates/cli/src/args.rs b/crates/cli/src/args.rs index abbdb86..93af4de 100644 --- a/crates/cli/src/args.rs +++ b/crates/cli/src/args.rs @@ -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, @@ -1191,8 +1180,6 @@ pub async fn get_args() -> Result { 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 {