From 27f5bbfbcc9474c2f57c2b92b1feb898ae46ee70 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 27 Aug 2016 19:28:39 -0400 Subject: [PATCH] imp(Completions): uses standard conventions for bash completion files, namely '{bin}.bash-completion' Closes #567 --- src/app/mod.rs | 8 +++++--- src/app/parser.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index c2131679b86..3c7553444e8 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -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 - /// `/target/debug/build/myapp-/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 + /// `/target/debug/build/myapp-/out/myapp.bash-completion`. + /// + /// Fish shell completions will use the file format `{bin_name}.fish` pub fn gen_completions, S: Into>(&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()); diff --git a/src/app/parser.rs b/src/app/parser.rs index 2930534663b..9e6c5966d43 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -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", };