summary refs log tree commit diff
path: root/Completion/Base/_condition
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-11 07:57:56 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-11 07:57:56 +0000
commitfac3086d9782e73dcaf1aa65fd36a0b63a374719 (patch)
tree7bab35e2787ca17f02ec932dffae1bfff2ffcfe3 /Completion/Base/_condition
parent37012f06a7e5e8a64614dbf9032c77cff1bcfcfb (diff)
downloadzsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.gz
zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.xz
zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.zip
_wanted now tests both tags and labels; change places where _wanted was called without a command; allow multiple patterns per string in file-patterns; update _next_tags to work with labels (10632)
Diffstat (limited to 'Completion/Base/_condition')
-rw-r--r--Completion/Base/_condition59
1 files changed, 52 insertions, 7 deletions
diff --git a/Completion/Base/_condition b/Completion/Base/_condition
index 3e45e1b8f..b6a4eff7a 100644
--- a/Completion/Base/_condition
+++ b/Completion/Base/_condition
@@ -1,10 +1,55 @@
-#defcomp -condition-
+#compdef -condition-
 
-if [[ -current -1 -o ]]; then
-  complist -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}'
-elif [[ -current -1 -nt || -current -1 -ot || -current -1 -ef ]]; then
-  _files
+local prev="$words[CURRENT-1]" ret=1
+
+if [[ "$prev" = -o ]]; then
+  _tags -C -o options && _options
+elif [[ "$prev" = -([a-hkprsuwxLOGSN]|[no]t|ef) ]]; then
+  _tags -C "$prev" files && _files
 else
-  _files
-  complist -v
+  if [[ "$PREFIX" = -* ]] ||
+     ! zstyle -T ":completion:${curcontext}:options" prefix-needed; then
+
+    if [[ "$prev" = (\[\[|\|\||\&\&|\!|\() ]]; then
+      _describe -o 'condition code' \
+                '( -a:existing\ file
+	           -b:block\ special\ file
+	           -c:character\ special\ file
+	           -d:directory
+	           -e:existing\ file
+	           -f:regular\ file
+	           -g:setgid\ bit
+	           -h:symbolic\ link
+	           -k:sticky\ bit
+	           -n:non-empty\ string
+	           -o:option
+	           -p:named\ pipe
+	           -r:readable\ file
+	           -s:non-empty\ file
+	           -t:terminal\ file\ descriptor
+	           -u:setuid\ bit
+	           -w:writable\ file
+	           -x:executable\ file
+	           -z:empty\ string
+	           -L:symbolic\ link
+	           -O:own\ file
+	           -G:group-owned\ file
+	           -S:socket
+	           -N:unread\ file)' && ret=0
+    else
+      _describe -o 'condition code' \
+	        '( -nt:newer\ than
+	           -ot:older\ than
+	           -ef:same\ file
+	           -eq:numerically\ equal
+	           -ne:numerically\ not\ equal
+	           -lt:numerically\ less\ than
+	           -le:numerically\ less\ then\ or\ equal
+	           -lt:numerically\ greater\ than
+	           -le:numerically\ greater\ then\ or\ equal)' && ret=0
+    fi
+  fi
+  _alternative 'files:: _files' 'parameters:: _parameters' && ret=0
+
+  return ret
 fi