Skip to content

Commit

Permalink
fix(complete): Complete visible, rather than hidden, values
Browse files Browse the repository at this point in the history
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
  • Loading branch information
epage committed May 6, 2022
1 parent 17b930c commit b266e6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clap_complete/src/shells/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>()
.join(" ")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/sub_subcommands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/value_hint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b266e6d

Please sign in to comment.