mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
imp(Completions): adds fallbacks to Bash completions
With these options, in case the completion function cannot provide suggestions, Bash will perform its default completions, based on e.g. files, directories, and variable names. This is particularly useful for argument values.
This commit is contained in:
parent
69541d6daf
commit
b1b16d56d8
2 changed files with 2 additions and 2 deletions
|
@ -58,7 +58,7 @@ impl<'a, 'b> BashGen<'a, 'b> {
|
|||
esac
|
||||
}}
|
||||
|
||||
complete -F _{name} {name}
|
||||
complete -F _{name} -o bashdefault -o default {name}
|
||||
",
|
||||
name = self.p.meta.bin_name.as_ref().unwrap(),
|
||||
name_opts = self.all_options_for_path(self.p.meta.bin_name.as_ref().unwrap()),
|
||||
|
|
|
@ -21,5 +21,5 @@ fn test_generation() {
|
|||
let last_line = string.lines().rev().nth(0).unwrap();
|
||||
|
||||
assert_eq!(first_line, "_myapp() {");
|
||||
assert_eq!(last_line, "complete -F _myapp myapp");
|
||||
assert_eq!(last_line, "complete -F _myapp -o bashdefault -o default myapp");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue