diff --git a/0001-use-.bash-as-extension-for-bash-completions.patch b/0001-use-.bash-as-extension-for-bash-completions.patch new file mode 100644 index 0000000..ab35848 --- /dev/null +++ b/0001-use-.bash-as-extension-for-bash-completions.patch @@ -0,0 +1,70 @@ +From 63f7c329adc315610a8d63b3ddc510d9e3209399 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Thu, 23 Nov 2017 18:38:42 +0100 +Subject: [PATCH] use .bash as extension for bash completions + +* bash-completions have code to use only `foo`, `foo.bash` and `_foo` +files for completion +* /usr is proper place for system-wide stuff rather than /etc + +Signed-off-by: Igor Gnatenko +--- + src/app/mod.rs | 6 +++--- + src/app/parser.rs | 2 +- + src/completions/shell.rs | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/app/mod.rs b/src/app/mod.rs +index d08f9de0..1b7643df 100644 +--- a/src/app/mod.rs ++++ b/src/app/mod.rs +@@ -1375,9 +1375,9 @@ impl<'a, 'b> App<'a, 'b> { + /// outdir); // Then say where write the completions to + /// } + /// ``` +- /// Now, once we combile there will be a `{bin_name}.bash-completion` file in the directory. ++ /// Now, once we combile there will be a `{bin_name}.bash` file in the directory. + /// Assuming we compiled with debug mode, it would be somewhere similar to +- /// `/target/debug/build/myapp-/out/myapp.bash-completion`. ++ /// `/target/debug/build/myapp-/out/myapp.bash`. + /// + /// Fish shell completions will use the file format `{bin_name}.fish` + pub fn gen_completions, S: Into>(&mut self, +@@ -1419,7 +1419,7 @@ impl<'a, 'b> App<'a, 'b> { + /// Usage: + /// + /// ```shell +- /// $ myapp generate-bash-completions > /etc/bash_completion.d/myapp ++ /// $ myapp generate-bash-completions > /usr/share/bash-completion/completions/myapp.bash + /// ``` + pub fn gen_completions_to>(&mut self, + bin_name: S, +diff --git a/src/app/parser.rs b/src/app/parser.rs +index dafcf076..0b3d9406 100644 +--- a/src/app/parser.rs ++++ b/src/app/parser.rs +@@ -113,7 +113,7 @@ impl<'a, 'b> Parser<'a, 'b> + let out_dir = PathBuf::from(od); + let name = &*self.meta.bin_name.as_ref().unwrap().clone(); + let file_name = match for_shell { +- Shell::Bash => format!("{}.bash-completion", name), ++ Shell::Bash => format!("{}.bash", name), + Shell::Fish => format!("{}.fish", name), + Shell::Zsh => format!("_{}", name), + Shell::PowerShell => format!("_{}.ps1", name), +diff --git a/src/completions/shell.rs b/src/completions/shell.rs +index 60513ede..bb823c1d 100644 +--- a/src/completions/shell.rs ++++ b/src/completions/shell.rs +@@ -6,7 +6,7 @@ use std::fmt; + #[cfg_attr(feature = "lints", allow(enum_variant_names))] + #[derive(Debug, Copy, Clone)] + pub enum Shell { +- /// Generates a .bash-completion completion file for the Bourne Again SHell (BASH) ++ /// Generates a .bash completion file for the Bourne Again SHell (BASH) + Bash, + /// Generates a .fish completion file for the Friendly Interactive SHell (fish) + Fish, +-- +2.15.0 + diff --git a/rust-clap.spec b/rust-clap.spec index 496321d..a9ef6be 100644 --- a/rust-clap.spec +++ b/rust-clap.spec @@ -6,7 +6,7 @@ Name: rust-%{crate} Version: 2.27.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Simple to use, efficient, and full featured Command Line Argument Parser License: MIT @@ -20,6 +20,8 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{ Patch0: clap-2.27.1-fix-metadata.diff # Real bump of bitflags Patch1: 0001-Update-bitflags-to-1.0.patch +# https://github.com/kbknapp/clap-rs/pull/1114 +Patch2: 0001-use-.bash-as-extension-for-bash-completions.patch ExclusiveArch: %{rust_arches} @@ -76,6 +78,9 @@ which use %{crate} from crates.io. %exclude %{cargo_registry}/%{crate}-%{version}/{index.html,justfile} %changelog +* Thu Nov 23 2017 Igor Gnatenko - 2.27.1-3 +- Use proper file extension for bash completions + * Mon Nov 20 2017 Igor Gnatenko - 2.27.1-2 - Bump version-sync to 0.5