summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-01 15:39:51 -0700
committerEd Santiago <santiago@redhat.com>2019-03-13 16:40:07 -0600
commit6aa8078cc1f54a5c6e6197d7e0273e36ed55060e (patch)
tree2b8b1aeb3c0c09bd53bc988da4a68cf33f233542 /Makefile
parent7426d4fbbeaf5ebd3d55576add89b99cd3f3f760 (diff)
downloadpodman-6aa8078cc1f54a5c6e6197d7e0273e36ed55060e.tar.gz
podman-6aa8078cc1f54a5c6e6197d7e0273e36ed55060e.tar.bz2
podman-6aa8078cc1f54a5c6e6197d7e0273e36ed55060e.zip
zsh completion
Weekend hack by someone who doesn't grok zsh completion but who finds it deeply offensive that most completion files have an unmaintainable duplication of options and arguments. The idea behind this one is to discover the command line using --help, with a few hardcoded helpers for discovering containers, images, pods, and figuring out which args take files/dirs as args. Working remarkably well. I am using this in my daily routine and wondering how I ever managed without it. It's not perfect -- a future version can perhaps show only stopped containers for podman rm, only running ones for podman stop -- but ROI seems low on that given my limited zsh completion skills. Sadly, I can't figure out how to write a regression test suite for this. It would be lovely to have a list if partial command lines and expected completions, because the history of this change is that (seemingly) minor tweaks in one place cause breakage in another. Does anyone know of such a framework? Still... working well enough to ship, IMO. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 782fa4e62..03e21cbe1 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@ CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
OCI_RUNTIME ?= ""
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
+ZSHINSTALLDIR=${PREFIX}/share/zsh/site-functions
SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z)
PACKAGES ?= $(shell $(GO) list -tags "${BUILDTAGS}" ./... | grep -v github.com/containers/libpod/vendor | grep -v e2e | grep -v system )
@@ -247,6 +248,8 @@ install.config:
install.completions:
install ${SELINUXOPT} -d -m 755 ${BASHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/bash/podman ${BASHINSTALLDIR}
+ install ${SELINUXOPT} -d -m 755 ${ZSHINSTALLDIR}
+ install ${SELINUXOPT} -m 644 completions/zsh/_podman ${ZSHINSTALLDIR}
install.cni:
install ${SELINUXOPT} -d -m 755 ${ETCDIR}/cni/net.d/
@@ -332,6 +335,7 @@ API.md: cmd/podman/varlink/io.podman.varlink
validate.completions: completions/bash/podman
. completions/bash/podman
+ if [ -x /bin/zsh ]; then /bin/zsh completions/zsh/_podman; fi
validate: gofmt .gitvalidation validate.completions