From 899da7ec823cea5c03fc85acab2e7b2a0bbfddfe Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 16 Apr 2024 03:52:01 +0000 Subject: [PATCH] refactor: compgen assigned option with `=` suffix --- src/matcher.rs | 5 +++++ .../integration__compgen__option_assigned.snap | Bin 740 -> 745 bytes 2 files changed, 5 insertions(+) diff --git a/src/matcher.rs b/src/matcher.rs index d947a1b..24ed256 100644 --- a/src/matcher.rs +++ b/src/matcher.rs @@ -1071,6 +1071,11 @@ impl<'a, 'b> Matcher<'a, 'b> { }; for v in param.list_names() { let nospace = param.prefixed() || param.assigned(); + let v = if param.assigned() && v.len() > 2 { + format!("{v}=") + } else { + v + }; output.push((v, describe.to_string(), nospace, kind)) } } diff --git a/tests/snapshots/integration__compgen__option_assigned.snap b/tests/snapshots/integration__compgen__option_assigned.snap index d2278fbbbdb7e5cf4a28d7532bb2277e82ca273c..96ca479cf86a781b0a0bd5625fd1a69e7d2f6091 100644 GIT binary patch delta 59 tcmaFD`jT}*3Zw1hi%i0k>lx)IPP+!@7{gf#lb>T CJrZ01