Skip to content

Commit

Permalink
Merge pull request #4896 from clubby789/bash-hint-other
Browse files Browse the repository at this point in the history
completion: Respect `ValueHint::Other` in Bash
  • Loading branch information
epage committed May 9, 2023
2 parents 0174326 + 2f97216 commit fca1e03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions clap_complete/src/shells/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ fn vals_for(o: &Arg) -> String {
.collect::<Vec<_>>()
.join(" ")
)
} else if o.get_value_hint() == ValueHint::Other {
String::from("\"${cur}\"")
} else {
String::from("$(compgen -f \"${cur}\")")
}
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 @@ -34,7 +34,7 @@ _my-app() {
return 0
;;
--other)
COMPREPLY=($(compgen -f "${cur}"))
COMPREPLY=("${cur}")
return 0
;;
--path)
Expand Down

0 comments on commit fca1e03

Please sign in to comment.