[packages/kubectl] package shell completions

atler atler at pld-linux.org
Wed Feb 23 20:24:10 CET 2022


commit 53a59a69ff0f4a1e1f58729a88447a3a2067a5f7
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Feb 23 20:22:37 2022 +0100

    package shell completions

 kubectl.spec | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)
---
diff --git a/kubectl.spec b/kubectl.spec
index 206f80f..2dc0280 100644
--- a/kubectl.spec
+++ b/kubectl.spec
@@ -13,6 +13,7 @@ Source0:	https://dl.k8s.io/v%{version}/kubernetes-src.tar.gz
 # Source0-md5:	f895c16fd87ceeaa945e006f0e0e981c
 URL:		http://kubernetes.io/
 BuildRequires:	golang >= 1.16
+BuildRequires:	rpm-build >= 4.6
 BuildRequires:	rpmbuild(macros) >= 2.009
 ExclusiveArch:	%go_arches
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -27,6 +28,36 @@ kubernetes package.
 It groups containers that make up an application into logical units
 for management and discovery.
 
+%package -n bash-completion-kubectl
+Summary:	Bash completion for kubectl command line
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	bash-completion >= 2.0
+BuildArch:	noarch
+
+%description -n bash-completion-kubectl
+Bash completion for kubectl command line.
+
+%package -n fish-completion-kubectl
+Summary:	fish-completion for kubectl
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	fish
+BuildArch:	noarch
+
+%description -n fish-completion-kubectl
+fish-completion for kubectl.
+
+%package -n zsh-completion-kubectl
+Summary:	ZSH completion for kubectl command line
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	zsh
+BuildArch:	noarch
+
+%description -n zsh-completion-kubectl
+ZSH completion for kubectl command line.
+
 %prep
 %setup -qc
 
@@ -41,12 +72,28 @@ ldflags="-X k8s.io/component-base/version.gitMajor=%{major} \
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_bindir}
+install -d $RPM_BUILD_ROOT{%{_bindir},%{bash_compdir},%{fish_compdir},%{zsh_compdir}}
 install -p target/kubectl $RPM_BUILD_ROOT%{_bindir}
 
+./target/kubectl completion bash > $RPM_BUILD_ROOT%{bash_compdir}/kubectl
+./target/kubectl completion fish > $RPM_BUILD_ROOT%{fish_compdir}/kubectl.fish
+./target/kubectl completion zsh > $RPM_BUILD_ROOT%{zsh_compdir}/_kubectl
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/kubectl
+
+%files -n bash-completion-kubectl
+%defattr(644,root,root,755)
+%{bash_compdir}/kubectl
+
+%files -n fish-completion-kubectl
+%defattr(644,root,root,755)
+%{fish_compdir}/kubectl.fish
+
+%files -n zsh-completion-kubectl
+%defattr(644,root,root,755)
+%{zsh_compdir}/_kubectl
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kubectl.git/commitdiff/53a59a69ff0f4a1e1f58729a88447a3a2067a5f7



More information about the pld-cvs-commit mailing list