From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: _groups and _condition
Date: Sun, 12 Mar 2000 15:22:28 +0000 [thread overview]
Message-ID: <38CBB634.816D2213@u.genie.co.uk> (raw)
When completing groups, just checking that the ypcat command exists is
not a reliable way of determining if YP is being used: it exists here
but isn't used. This patch to _groups, makes it also check the exit code
from ypcat (which fails here). There may be better ways of determining
if NIS is being used. Doesn't it use something like '+:+' as the last
line of /etc/passwd?
Also here, is a patch against _condition so that it completes only files
after more of its options. Incidentally, I had a look at whether it
would be possible to add a completion for test and, more specifically,
the '[' builtin. Putting [ or \[ after #compdef doesn't work. I can't
use '[' as a key to an associative array if I use an assignment like:
foo[\[]=whatever though it works fine if I do: a='[';foo[$a]=whatever
or use an array style assignment.
Oliver Kiddle
--- Completion/User/_groups.bak Thu Feb 17 17:52:19 2000
+++ Completion/User/_groups Sun Mar 12 07:18:55 2000
@@ -1,13 +1,13 @@
#compdef newgrp
-local expl groups
+local expl groups tmp
_wanted groups expl group || return 1
if ! zstyle -a ":completion:${curcontext}:" groups groups; then
(( $+_cache_groups )) ||
- if (( ${+commands[ypcat]} )); then
- : ${(A)_cache_groups:=${${(s: :)$(ypcat group.byname)}%%:*}} #
If you use YP
+ if (( ${+commands[ypcat]} )) && tmp=$(ypcat group.byname); then
+ : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP
else
: ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
fi
--- Completion/Base/_condition.bak Sun Mar 12 06:42:06 2000
+++ Completion/Base/_condition Sun Mar 12 06:46:23 2000
@@ -4,7 +4,7 @@
if [[ "$prev" = -o ]]; then
_tags -C -o options && _options
-elif [[ "$prev" = -([no]t|ef) ]]; then
+elif [[ "$prev" = -([a-hkprsuwxLOGSN]|[no]t|ef) ]]; then
_tags -C "$prev" files && _files
else
_alternative 'files:: _files' 'parameters:: _parameters'
next reply other threads:[~2000-03-12 15:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-12 15:22 Oliver Kiddle [this message]
2000-03-12 15:30 ` Oliver Kiddle
2000-03-12 22:34 ` Bart Schaefer
2000-03-12 21:36 ` Bart Schaefer
2000-03-13 12:17 Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38CBB634.816D2213@u.genie.co.uk \
--to=opk@u.genie.co.uk \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).