[pve-devel] [PATCH cluster] 1891 Add zsh command completion for pvecm

Christian Ebner c.ebner at proxmox.com
Thu Feb 21 14:25:01 CET 2019


This adds the generation of the zsh command completion scripts for
pvecm.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 data/PVE/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/data/PVE/Makefile b/data/PVE/Makefile
index b87a0f8..509f0ea 100644
--- a/data/PVE/Makefile
+++ b/data/PVE/Makefile
@@ -3,6 +3,7 @@ PERL5DIR=${DESTDIR}/usr/share/perl5
 PVEDIR=${PERL5DIR}/PVE
 MAN=${DESTDIR}/usr/share/man
 BASHCOMPLETION=${DESTDIR}/usr/share/bash-completion/completions
+ZSHCOMPLETION=${DESTDIR}/usr/share/zsh/vendor-completions
 
 PERL_VENDORARCH=$(shell perl -MConfig -e 'print $$Config{vendorarch};')
 PVE_VENDORARCH=${DESTDIR}/${PERL_VENDORARCH}/auto/PVE/IPCC
@@ -15,7 +16,7 @@ SOURCES=IPCC.pm Cluster.pm Corosync.pm
 all:
 
 .PHONY: install
-install: pvecm ${SOURCES} IPCC.so pvecm.1 pvecm.bash-completion datacenter.cfg.5
+install: pvecm ${SOURCES} IPCC.so pvecm.1 pvecm.bash-completion pvecm.zsh-completion datacenter.cfg.5
 	install -D -m 0755 pvecm ${DESTDIR}/usr/bin/pvecm
 	install -d ${PVEDIR}
 	for f in ${SOURCES}; do install -m 0664 $$f ${PVEDIR}/$$f; done
@@ -23,12 +24,17 @@ install: pvecm ${SOURCES} IPCC.so pvecm.1 pvecm.bash-completion datacenter.cfg.5
 	install -D pvecm.1 ${MAN}/man1/pvecm.1
 	install -D datacenter.cfg.5 ${MAN}/man5/datacenter.cfg.5
 	install -m 0644 -D pvecm.bash-completion ${BASHCOMPLETION}/pvecm
+	install -m 0644 -D pvecm.zsh-completion ${ZSHCOMPLETION}/_pvecm
 	for d in ${SUBDIRS}; do $(MAKE) -C $$d install; done
 
 %.bash-completion:
 	perl -I.. -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_bash_completions();" >$@.tmp
 	mv $@.tmp $@
 
+%.zsh-completion:
+	perl -I.. -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_zsh_completions();" >$@.tmp
+	mv $@.tmp $@
+
 Cluster/IPCConst.pm:
 	$(MAKE) -C Cluster IPCConst.pm
 
@@ -56,5 +62,5 @@ export NOVIEW=1
 .PHONY: clean
 clean:
 	$(MAKE) cleanup-docgen
-	rm -f IPCC.so IPCC.o IPCC.c pvecm.bash-completion
+	rm -f IPCC.so IPCC.o IPCC.c pvecm.bash-completion pvecm.zsh-completion
 	for d in ${SUBDIRS}; do $(MAKE) -C $$d clean; done
-- 
2.11.0



More information about the pve-devel mailing list