diff --git a/clap_complete/src/shells/bash.rs b/clap_complete/src/shells/bash.rs index 139e2fc73ff..60e6b346cd4 100644 --- a/clap_complete/src/shells/bash.rs +++ b/clap_complete/src/shells/bash.rs @@ -206,6 +206,8 @@ fn vals_for(o: &Arg) -> String { .collect::>() .join(" ") ) + } else if o.get_value_hint() == ValueHint::Other { + String::from("\"${cur}\"") } else { String::from("$(compgen -f \"${cur}\")") } diff --git a/clap_complete/tests/snapshots/value_hint.bash b/clap_complete/tests/snapshots/value_hint.bash index f92d402112d..e0a39cb8d4b 100644 --- a/clap_complete/tests/snapshots/value_hint.bash +++ b/clap_complete/tests/snapshots/value_hint.bash @@ -34,7 +34,7 @@ _my-app() { return 0 ;; --other) - COMPREPLY=($(compgen -f "${cur}")) + COMPREPLY=("${cur}") return 0 ;; --path)