Skip to content

Commit b266e6d

Browse files
committed
fix(complete): Complete visible, rather than hidden, values
In a refactor for clap-rs#3503, one of the checks for `is_hide_set` got flipped and we are completing hidden `PossibleValue`s rather than visible. Fixes clap-rs#3697
1 parent 17b930c commit b266e6d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clap_complete/src/shells/bash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn vals_for(o: &Arg) -> String {
178178
format!(
179179
"$(compgen -W \"{}\" -- \"${{cur}}\")",
180180
vals.iter()
181-
.filter(|pv| pv.is_hide_set())
181+
.filter(|pv| !pv.is_hide_set())
182182
.map(PossibleValue::get_name)
183183
.collect::<Vec<_>>()
184184
.join(" ")

clap_complete/tests/snapshots/sub_subcommands.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ _my-app() {
9494
fi
9595
case "${prev}" in
9696
--config)
97-
COMPREPLY=($(compgen -W "" -- "${cur}"))
97+
COMPREPLY=($(compgen -W "Lest quotes aren't escaped." -- "${cur}"))
9898
return 0
9999
;;
100100
*)

clap_complete/tests/snapshots/value_hint.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _my-app() {
2626
fi
2727
case "${prev}" in
2828
--choice)
29-
COMPREPLY=($(compgen -W "" -- "${cur}"))
29+
COMPREPLY=($(compgen -W "bash fish zsh" -- "${cur}"))
3030
return 0
3131
;;
3232
--unknown)

0 commit comments

Comments
 (0)