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:
Daniel Luz 2016-12-01 23:27:35 -02:00
parent 69541d6daf
commit b1b16d56d8
2 changed files with 2 additions and 2 deletions

View file

@ -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()),

View file

@ -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");
}