diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-02 11:22:21 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-02 11:22:21 +0000 |
commit | cd26a391d9c9a6694765cddd30a1cd4334aaed6e (patch) | |
tree | f17515e149d572561f442cd2a385c6d60b9d96ae /Completion | |
parent | 1a13dc1fb1ecd1da64ada063f9a2077f25fbc2f7 (diff) | |
download | zsh-cd26a391d9c9a6694765cddd30a1cd4334aaed6e.tar.gz zsh-cd26a391d9c9a6694765cddd30a1cd4334aaed6e.tar.xz zsh-cd26a391d9c9a6694765cddd30a1cd4334aaed6e.zip |
moved from Completion/Base/_condition
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Zsh/Context/_condition | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Completion/Zsh/Context/_condition b/Completion/Zsh/Context/_condition new file mode 100644 index 000000000..b6a4eff7a --- /dev/null +++ b/Completion/Zsh/Context/_condition @@ -0,0 +1,55 @@ +#compdef -condition- + +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 + 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 |