From b266e6d35d9f8f097ded7e5ede4d42776409dbde Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 6 May 2022 09:14:29 -0500 Subject: [PATCH] fix(complete): Complete visible, rather than hidden, values In a refactor for #3503, one of the checks for `is_hide_set` got flipped and we are completing hidden `PossibleValue`s rather than visible. Fixes #3697 --- clap_complete/src/shells/bash.rs | 2 +- clap_complete/tests/snapshots/sub_subcommands.bash | 2 +- clap_complete/tests/snapshots/value_hint.bash | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clap_complete/src/shells/bash.rs b/clap_complete/src/shells/bash.rs index 08bf1190cc3..a95047df7e3 100644 --- a/clap_complete/src/shells/bash.rs +++ b/clap_complete/src/shells/bash.rs @@ -178,7 +178,7 @@ fn vals_for(o: &Arg) -> String { format!( "$(compgen -W \"{}\" -- \"${{cur}}\")", vals.iter() - .filter(|pv| pv.is_hide_set()) + .filter(|pv| !pv.is_hide_set()) .map(PossibleValue::get_name) .collect::>() .join(" ") diff --git a/clap_complete/tests/snapshots/sub_subcommands.bash b/clap_complete/tests/snapshots/sub_subcommands.bash index c39eb589e66..85729508196 100644 --- a/clap_complete/tests/snapshots/sub_subcommands.bash +++ b/clap_complete/tests/snapshots/sub_subcommands.bash @@ -94,7 +94,7 @@ _my-app() { fi case "${prev}" in --config) - COMPREPLY=($(compgen -W "" -- "${cur}")) + COMPREPLY=($(compgen -W "Lest quotes aren't escaped." -- "${cur}")) return 0 ;; *) diff --git a/clap_complete/tests/snapshots/value_hint.bash b/clap_complete/tests/snapshots/value_hint.bash index 4138007acfc..39e8208b864 100644 --- a/clap_complete/tests/snapshots/value_hint.bash +++ b/clap_complete/tests/snapshots/value_hint.bash @@ -26,7 +26,7 @@ _my-app() { fi case "${prev}" in --choice) - COMPREPLY=($(compgen -W "" -- "${cur}")) + COMPREPLY=($(compgen -W "bash fish zsh" -- "${cur}")) return 0 ;; --unknown)