about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-11-05 01:09:26 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-11-05 01:09:26 +0100
commitbceb8e0ceb9778801e8e4b579f0f53e7feadfd2b (patch)
tree2d8572b46f20ed1d29ad2b2711b80310d6a11455
parent36f3dd812116850393db3fc225f8dde50512cb6e (diff)
downloadxe-bceb8e0ceb9778801e8e4b579f0f53e7feadfd2b.tar.gz
xe-bceb8e0ceb9778801e8e4b579f0f53e7feadfd2b.tar.xz
xe-bceb8e0ceb9778801e8e4b579f0f53e7feadfd2b.zip
_xe: add zsh completion
-rw-r--r--Makefile5
-rw-r--r--_xe20
2 files changed, 24 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 32f481d..a511749 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 ALL=xe
+ZSHCOMP=_xe
 
 CFLAGS=-g -O2 -Wall -Wno-switch -Wextra -Wwrite-strings
 
@@ -6,6 +7,7 @@ DESTDIR=
 PREFIX=/usr/local
 BINDIR=$(PREFIX)/bin
 MANDIR=$(PREFIX)/share/man
+ZSHCOMPDIR=$(PREFIX)/share/zsh/site-functions
 
 all: $(ALL)
 
@@ -16,9 +18,10 @@ check: FRC all
 	prove -v
 
 install: FRC all
-	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(ZSHCOMPDIR)
 	install -m0755 $(ALL) $(DESTDIR)$(BINDIR)
 	install -m0644 $(ALL:=.1) $(DESTDIR)$(MANDIR)/man1
+	install -m0644 $(ZSHCOMP) $(DESTDIR)$(ZSHCOMPDIR)
 
 README: xe.1
 	mandoc -Tutf8 $< | col -bx >$@
diff --git a/_xe b/_xe
new file mode 100644
index 0000000..71dcfcc
--- /dev/null
+++ b/_xe
@@ -0,0 +1,20 @@
+#compdef xe
+
+_arguments -s -S -A '-*' : \
+	'-f[read argument from file]:file:_files' \
+	'-s[use shell]:script: ' \
+	'-a[use arguments after --]' \
+	'-A[use arguments after separator]:separator: ' \
+        '-0[read arguments NUL-separated]' \
+	'-F[fatal: stop when a command fails]' \
+	'*-L[line-buffer output]' \
+	'-R[return 122 when no arguments are specified]' \
+	'-n[dry run (do not run commands)]' \
+	'-q[quiet mode]' \
+	'*-v[verbose mode]' \
+	'-I[argument replacement string]:string: ' \
+	'-j[maximum number of parallel command executions]:number: ' \
+	'(-p)-N[maximum number of arguments per command]:number: ' \
+	'(-N)-p[enable percent rules]:percent pattern: ' \
+	'(-):command name: _command_names -e' \
+	'*::arguments:_normal'