Skip to content

Commit

Permalink
imp(Completions): uses standard conventions for bash completion files…
Browse files Browse the repository at this point in the history
…, namely '{bin}.bash-completion'

Closes #567
  • Loading branch information
kbknapp committed Aug 27, 2016
1 parent f43b7c6 commit 27f5bbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,9 +1081,11 @@ impl<'a, 'b> App<'a, 'b> {
/// env!("OUT_DIR")); // Then say where write the completions to
/// }
/// ```
/// Now, once we combile there will be a `bash.sh` file in the directory. Assuming we compiled
/// with debug mode, it would be somewhere similar to
/// `<project>/target/debug/build/myapp-<hash>/out/myapp_bash.sh`
/// Now, once we combile there will be a `{bin_name}.bash-completion` file in the directory.
/// Assuming we compiled with debug mode, it would be somewhere similar to
/// `<project>/target/debug/build/myapp-<hash>/out/myapp.bash-completion`.
///
/// Fish shell completions will use the file format `{bin_name}.fish`
pub fn gen_completions<T: Into<OsString>, S: Into<String>>(&mut self, bin_name: S, for_shell: Shell, out_dir: T) {
self.p.meta.bin_name = Some(bin_name.into());
self.p.gen_completions(for_shell, out_dir.into());
Expand Down
2 changes: 1 addition & 1 deletion src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'a, 'b> Parser<'a, 'b>

let out_dir = PathBuf::from(od);
let suffix = match for_shell {
Shell::Bash => "_bash.sh",
Shell::Bash => ".bash-completion",
Shell::Fish => ".fish",
};

Expand Down

0 comments on commit 27f5bbf

Please sign in to comment.