From 2715992d2f8554fd47a4ef2ea1dd20d08ce011d4 Mon Sep 17 00:00:00 2001 From: rose <132@ikl.sh> Date: Tue, 19 Aug 2025 15:04:05 -0400 Subject: [PATCH] Mitigate `watch -d` breaking change (#16473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR reverts the breaking change of short flag change of `watch -d` to `--debounce` instead of `--debounce-ms`. This fully prevents #16187 from being a breaking change. Before #16187: ```nushell watch -d 1000 foo {} # => Now watching files at "/home/rose/foo". Press ctrl+c to abort. ``` Before this PR (after #16187): ```nushell watch -d 1000 foo {} # => Error: nu::parser::parse_mismatch # => # => × Parse mismatch during operation. # => ╭─[entry #15:1:10] # => 1 │ watch -d 1000 foo {} # => · ──┬─ # => · ╰── expected duration with valid units # => ╰──── ``` After this PR (after #16187): ```nushell watch -d 1000 foo {} # => Warning: nu::parser::deprecated # => # => ⚠ Flag deprecated. # => ╭─[entry #3:1:7] # => 1 │ watch -d 1000 foo {} # => · ─┬ # => · ╰── watch --debounce-ms was deprecated in 0.107.0 and will be removed in 0.109.0. # => ╰──── # => help: `--debounce-ms` will be removed in favour of `--debounce` # => # => Now watching files at "/home/rose/foo". Press ctrl+c to abort. ``` This PR also fixes the `DeprecationEntry` which incorrectly had a `--` in it, which I failed to realize when reviewing #16187. We should add a `debug_assert` or something for this. Rel: #16187 ## Release notes summary - What our users need to know N/A ## Tasks after submitting - [ ] Add `debug_assert` for `DeprecationType::Flag`s with `--` --- crates/nu-command/src/filesystem/watch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/filesystem/watch.rs b/crates/nu-command/src/filesystem/watch.rs index 44417263f5..90fca2f5ba 100644 --- a/crates/nu-command/src/filesystem/watch.rs +++ b/crates/nu-command/src/filesystem/watch.rs @@ -45,7 +45,7 @@ impl Command for Watch { fn deprecation_info(&self) -> Vec { vec![DeprecationEntry { - ty: DeprecationType::Flag("--debounce-ms".into()), + ty: DeprecationType::Flag("debounce-ms".into()), report_mode: ReportMode::FirstUse, since: Some("0.107.0".into()), expected_removal: Some("0.109.0".into()), @@ -76,13 +76,13 @@ impl Command for Watch { "debounce-ms", SyntaxShape::Int, "Debounce changes for this many milliseconds (default: 100). Adjust if you find that single writes are reported as multiple events (deprecated)", - None, + Some('d'), ) .named( "debounce", SyntaxShape::Duration, "Debounce changes for this duration (default: 100ms). Adjust if you find that single writes are reported as multiple events", - Some('d'), + None, ) .named( "glob",