mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52: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() {
|
||||
ValueHint::FilePath => Some("compopt -o filenames"),
|
||||
ValueHint::DirPath => Some("compopt -o plusdirs"),
|
||||
ValueHint::Other => Some("compopt -o nospace"),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
|
|
|
@ -542,6 +542,9 @@ _exhaustive() {
|
|||
;;
|
||||
--other)
|
||||
COMPREPLY=("${cur}")
|
||||
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||
compopt -o nospace
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
--path)
|
||||
|
|
|
@ -35,6 +35,9 @@ _my-app() {
|
|||
;;
|
||||
--other)
|
||||
COMPREPLY=("${cur}")
|
||||
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||
compopt -o nospace
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
--path)
|
||||
|
|
|
@ -210,7 +210,7 @@ fn complete() {
|
|||
}
|
||||
|
||||
let input = "exhaustive hint --other \t";
|
||||
let expected = "exhaustive hint --other % exhaustive hint --other ";
|
||||
let expected = "exhaustive hint --other % exhaustive hint --other ";
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
snapbox::assert_eq(expected, actual);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue