mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
fix(complete): Suppress a useless space completion
This commit is contained in:
parent
e25b1abddf
commit
13a79804c9
4 changed files with 8 additions and 1 deletions
|
@ -171,6 +171,7 @@ fn option_details_for_path(cmd: &Command, path: &str) -> String {
|
||||||
let compopt = match o.get_value_hint() {
|
let compopt = match o.get_value_hint() {
|
||||||
ValueHint::FilePath => Some("compopt -o filenames"),
|
ValueHint::FilePath => Some("compopt -o filenames"),
|
||||||
ValueHint::DirPath => Some("compopt -o plusdirs"),
|
ValueHint::DirPath => Some("compopt -o plusdirs"),
|
||||||
|
ValueHint::Other => Some("compopt -o nospace"),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -542,6 +542,9 @@ _exhaustive() {
|
||||||
;;
|
;;
|
||||||
--other)
|
--other)
|
||||||
COMPREPLY=("${cur}")
|
COMPREPLY=("${cur}")
|
||||||
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||||
|
compopt -o nospace
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--path)
|
--path)
|
||||||
|
|
|
@ -35,6 +35,9 @@ _my-app() {
|
||||||
;;
|
;;
|
||||||
--other)
|
--other)
|
||||||
COMPREPLY=("${cur}")
|
COMPREPLY=("${cur}")
|
||||||
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||||
|
compopt -o nospace
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--path)
|
--path)
|
||||||
|
|
Loading…
Reference in a new issue