about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:35:43 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:35:43 +0000
commit3911f9a417fd7890e7418b38c52082eb9a2cbaf1 (patch)
tree766ff59f82e0143d024b669ee5c57ed1f44edf5a
parent9e1a81d755a2a619d33bf4717f643a4525a29356 (diff)
downloadzsh-3911f9a417fd7890e7418b38c52082eb9a2cbaf1.tar.gz
zsh-3911f9a417fd7890e7418b38c52082eb9a2cbaf1.tar.xz
zsh-3911f9a417fd7890e7418b38c52082eb9a2cbaf1.zip
moved from Completion/Builtins/_signals
-rw-r--r--Completion/Unix/Type/_signals37
1 files changed, 37 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals
new file mode 100644
index 000000000..447d9d16c
--- /dev/null
+++ b/Completion/Unix/Type/_signals
@@ -0,0 +1,37 @@
+#autoload
+
+# Options (only in separate words):
+#
+# -a  use all signals (even the pseudo-signals)
+# -p  needs a `-' prefix
+#
+# A `-' or `--' as the first argument is ignored.
+
+local expl last=-3 minus
+
+while [[ "$1" = -[ap] ]]; do
+  if [[ "$1" = -a ]]; then
+    last=-1
+  else
+    minus=-
+  fi
+  shift
+done
+
+[[ "$1" = -(|-) ]] && shift
+
+if [[ -z "$minus" ]] ||
+   ! zstyle -T ":completion:${curcontext}:signals" prefix-needed ||
+   [[ "$PREFIX" = -* ]]; then
+  local disp tmp
+
+  if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then
+    tmp=( "${(@)signals[1,last]}" )
+    disp=(-d tmp)
+  else
+    disp=()
+  fi
+  _wanted signals expl signal \
+      compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \
+              "${minus}${(@)^signals[1,last]}"
+fi