summaryrefslogtreecommitdiffstats
path: root/Completion/Base/_condition
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-13 12:35:42 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-13 12:35:42 +0000
commit254a6e1c922b549f6de5b69c9e6a10ac35317c3d (patch)
tree689650c1b44d2b70fdb900769022e12bf98556d0 /Completion/Base/_condition
parentzsh-workers/10108 (diff)
downloadzsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar.gz
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar.bz2
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar.lz
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar.xz
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.tar.zst
zsh-254a6e1c922b549f6de5b69c9e6a10ac35317c3d.zip
zsh-workers/10112
Diffstat (limited to 'Completion/Base/_condition')
-rw-r--r--Completion/Base/_condition48
1 files changed, 46 insertions, 2 deletions
diff --git a/Completion/Base/_condition b/Completion/Base/_condition
index 5e599a53c..b6a4eff7a 100644
--- a/Completion/Base/_condition
+++ b/Completion/Base/_condition
@@ -1,11 +1,55 @@
#compdef -condition-
-local prev="$words[CURRENT-1]"
+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
- _alternative 'files:: _files' 'parameters:: _parameters'
+ 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