[pve-devel] [PATCH container 7/7] 1891 Add zsh command completion generation for pct

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


Generates the zsh command completion scripts for pct.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Makefile b/src/Makefile
index f68eb5d..b0c30de 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,6 +16,7 @@ PODDIR=${DOCDIR}/pod
 MAN1DIR=${MANDIR}/man1/
 MAN5DIR=${MANDIR}/man5/
 BASHCOMPLDIR=${PREFIX}/share/bash-completion/completions/
+ZSHCOMPLDIR=${PREFIX}/share/zsh/vendor-completions/
 export PERLDIR=${PREFIX}/share/perl5
 
 # this require package pve-doc-generator
@@ -28,12 +29,17 @@ pct.bash-completion:
 	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::CLI::pct; PVE::CLI::pct->generate_bash_completions();" >$@.tmp
 	mv $@.tmp $@
 
+pct.zsh-completion:
+	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::CLI::pct; PVE::CLI::pct->generate_zsh_completions();" >$@.tmp
+	mv $@.tmp $@
+
 .PHONY: check
 check: test
 	make -C test
 
 .PHONY: install
-install: pct lxc-pve.conf lxc-pve-prestart-hook lxc-pve-autodev-hook lxc-pve-poststop-hook lxcnetaddbr pct.1 pct.conf.5 pct.bash-completion pve-userns.seccomp
+install: pct lxc-pve.conf lxc-pve-prestart-hook lxc-pve-autodev-hook lxc-pve-poststop-hook	    \
+	    lxcnetaddbr pct.1 pct.conf.5 pct.bash-completion pct.zsh-completion pve-userns.seccomp
 	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::CLI::pct; PVE::CLI::pct->verify_api();"
 	install -d ${SBINDIR}
 	install -m 0755 pct ${SBINDIR}
@@ -52,6 +58,7 @@ install: pct lxc-pve.conf lxc-pve-prestart-hook lxc-pve-autodev-hook lxc-pve-pos
 	install -d ${LXC_COMMON_CONFIG_DIR}
 	install -m 0644 lxc-pve.conf ${LXC_COMMON_CONFIG_DIR}/01-pve.conf
 	install -m 0644 -D pct.bash-completion ${BASHCOMPLDIR}/pct
+	install -m 0644 -D pct.zsh-completion ${ZSHCOMPLDIR}/_pct
 	make -C PVE install
 	install -d ${MAN1DIR}
 	install -d ${MAN5DIR}
@@ -81,6 +88,7 @@ clean:
 	make -C test clean
 	make cleanup-docgen
 	rm -rf *.1 *.5 *.tmp *.bash-completion
+	rm -rf *.1 *.5 *.tmp *.zsh-completion
 	find . -name '*~' -exec rm {} ';'
 
 .PHONY: distclean
-- 
2.11.0




More information about the pve-devel mailing list