Skip to content

Commit

Permalink
imp(Completions): adds fallbacks to Bash completions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mernen committed Dec 2, 2016
1 parent 69541d6 commit b1b16d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/completions/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion tests/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

0 comments on commit b1b16d5

Please sign in to comment.