[pve-devel] [PATCH v2 manager] Fix 1891 Generate zsh tab completion scripts for cli tools

Christian Ebner c.ebner at proxmox.com
Wed Feb 20 12:02:02 CET 2019


This patch builds the  zsh tab completion scripts for the cli tools of
pve-manager.
In order for it to work, the latest version of pve-common and pve-docs
including the corresponding patches have to be installed on the build
system.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Version 2:
    * zsh completion scripts are now prefixed with _ as it is required for the
      automatic loading of the file

 bin/Makefile | 12 ++++++++++--
 defines.mk   |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/bin/Makefile b/bin/Makefile
index d6287833..52044ca9 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -33,6 +33,9 @@ BASH_COMPLETIONS = 						\
 	$(addsuffix .service-bash-completion, ${SERVICES}) 	\
 	$(addsuffix .bash-completion, ${CLITOOLS}) 		\
 
+ZSH_COMPLETIONS =						\
+	$(addsuffix .service-zsh-completion, ${SERVICES}) 	\
+	$(addsuffix .zsh-completion, ${CLITOOLS})		\
 
 all: ${SERVICE_MANS} ${CLI_MANS} pvemailforward
 
@@ -57,7 +60,7 @@ check: $(addsuffix .service-api-verified, ${SERVICES}) $(addsuffix .api-verified
 	rm -f *.service-api-verified *.api-verified
 
 .PHONY: install
-install: ${SCRIPTS} ${CLI_MANS} ${SERVICE_MANS} pvemailforward ${BASH_COMPLETIONS}
+install: ${SCRIPTS} ${CLI_MANS} ${SERVICE_MANS} pvemailforward ${BASH_COMPLETIONS} ${ZSH_COMPLETIONS}
 	install -d ${BINDIR}
 	install -m 0755 ${SCRIPTS} ${BINDIR}
 	install -s -m 2755 -g www-data pvemailforward ${BINDIR}
@@ -67,8 +70,13 @@ install: ${SCRIPTS} ${CLI_MANS} ${SERVICE_MANS} pvemailforward ${BASH_COMPLETION
 	install -m 0644 ${SERVICE_MANS} ${MAN8DIR}
 	for i in ${CLITOOLS}; do install -m 0644 -D $$i.bash-completion ${BASHCOMPLDIR}/$$i; done
 	for i in ${SERVICES}; do install -m 0644 -D $$i.service-bash-completion ${BASHCOMPLDIR}/$$i; done
+	for i in ${CLITOOLS}; do install -m 0644 -D $$i.zsh-completion ${ZSHCOMPLDIR}/_$$i; done
+	for i in ${SERVICES}; do install -m 0644 -D $$i.service-zsh-completion ${ZSHCOMPLDIR}/_$$i; done
 
 .PHONY: clean
 clean:
 	make cleanup-docgen
-	rm -rf *~ *.tmp ${CLI_MANS} ${SERVICE_MANS} *.1.pod *.8.pod pvemailforward *.bash-completion *.service-bash-completion *.api-verified *.service-api-verified
+	rm -rf *~ *.tmp ${CLI_MANS} ${SERVICE_MANS} *.1.pod *.8.pod pvemailforward  \
+	    *.bash-completion *.service-bash-completion				    \
+	    *.zsh-completion *.service-zsh-completion				    \
+	    *.api-verified *.service-api-verified
diff --git a/defines.mk b/defines.mk
index 80ba7738..11616db6 100644
--- a/defines.mk
+++ b/defines.mk
@@ -10,6 +10,7 @@ CRONDAILYDIR=${DESTDIR}/etc/cron.daily
 INITDBINDIR=${DESTDIR}/etc/init.d
 SERVICEDIR=${DESTDIR}/lib/systemd/system
 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
+ZSHCOMPLDIR=${DESTDIR}/usr/share/zsh/vendor-completions/
 HARADIR=${DESTDIR}/usr/share/cluster
 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
 PODDIR=${DESTDIR}/usr/share/doc/${PACKAGE}/pod
-- 
2.11.0




More information about the pve-devel mailing list