summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am5
-rwxr-xr-xcompletions/zsh/_bwrap14
-rw-r--r--configure.ac17
3 files changed, 23 insertions, 13 deletions
diff --git a/Makefile.am b/Makefile.am
index 644ea7c..1e4710b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,11 @@ bashcompletiondir = $(BASH_COMPLETION_DIR)
dist_bashcompletion_DATA = completions/bash/bwrap
endif
+if ENABLE_ZSH_COMPLETION
+zshcompletiondir = $(ZSH_COMPLETION_DIR)
+dist_zshcompletion_DATA = completions/zsh/_bwrap
+endif
+
-include $(top_srcdir)/git.mk
AM_DISTCHECK_CONFIGURE_FLAGS = \
diff --git a/completions/zsh/_bwrap b/completions/zsh/_bwrap
index c9edfb9..88c9b35 100755
--- a/completions/zsh/_bwrap
+++ b/completions/zsh/_bwrap
@@ -1,18 +1,5 @@
#compdef bwrap
-_all_caps() {
- # $ egrep '#define\sCAP_\w+\s+[0-9]+' /usr/include/linux/capability.h | awk '{print $2}' | xargs echo
- echo CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID \
- CAP_KILL CAP_SETGID CAP_SETUID CAP_SETPCAP CAP_LINUX_IMMUTABLE \
- CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_ADMIN CAP_NET_RAW \
- CAP_IPC_LOCK CAP_IPC_OWNER CAP_SYS_MODULE CAP_SYS_RAWIO CAP_SYS_CHROOT \
- CAP_SYS_PTRACE CAP_SYS_PACCT CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_NICE \
- CAP_SYS_RESOURCE CAP_SYS_TIME CAP_SYS_TTY_CONFIG CAP_MKNOD CAP_LEASE \
- CAP_AUDIT_WRITE CAP_AUDIT_CONTROL CAP_SETFCAP CAP_MAC_OVERRIDE \
- CAP_MAC_ADMIN CAP_SYSLOG CAP_WAKE_ALARM CAP_BLOCK_SUSPEND CAP_AUDIT_READ
-}
-
-
_bwrap_args=(
'*::arguments:_normal'
'--help[Print help and exit]'
@@ -73,6 +60,7 @@ _bwrap() {
_arguments -S $_bwrap_args
case "$state" in
caps)
+ # $ grep -E '#define\sCAP_\w+\s+[0-9]+' /usr/include/linux/capability.h | awk '{print $2}' | xargs echo
local all_caps=(
CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID \
CAP_KILL CAP_SETGID CAP_SETUID CAP_SETPCAP CAP_LINUX_IMMUTABLE \
diff --git a/configure.ac b/configure.ac
index c405b5f..f3742d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,23 @@ fi
AC_SUBST([BASH_COMPLETION_DIR])
AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
+
+AC_ARG_WITH([zsh-completion-dir],
+ AS_HELP_STRING([--with-zsh-completion-dir[=PATH]],
+ [Install the zsh auto-completion script in this directory. @<:@default=yes@:>@]),
+ [],
+ [with_zsh_completion_dir=yes])
+
+if test "x$with_zsh_completion_dir" = "xyes"; then
+ [ZSH_COMPLETION_DIR="$datadir/zsh/site-functions"]
+else
+ ZSH_COMPLETION_DIR="$with_bash_completion_dir"
+fi
+
+
+AC_SUBST([ZSH_COMPLETION_DIR])
+AM_CONDITIONAL([ENABLE_ZSH_COMPLETION], [test "x$with_zsh_completion_dir" != "xno"])
+
# ------------------------------------------------------------------------------
have_selinux=no
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))