Zsh Mailing List Archive
Messages sorted by:
Re: need for a fancier _pick_variant?
- X-seq: zsh-users 6728
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: need for a fancier _pick_variant?
- Date: Wed, 22 Oct 2003 06:39:03 +0000
- In-reply-to: <20031014062933.GC13457@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20031014062933.GC13457@xxxxxxxxxxxxxxxxxx>
[ I've been busy and then away, so catching up on some old stuff. ]
On Oct 13, 11:29pm, Danek Duvall wrote:
} _diff_options calls
} _pick_variant -c diff 'gnu=GNU' unix -v
} which doesn't match anything for Solaris diff, so the generic unix diff
} options are chosen, and the result is thrown by the -u.
} Unfortunately, I don't know of any way of distinguishing Solaris diff by
} its output, short of a brittle check of its usage statement.
I don't have access to a Solaris machine. Does `diff -v` produce the
usage message? If so, I suggest that you use the "brittle" test just
to decide whether certain options (such as -u) are available, and then
apply a different test to differentiate further. E.g. (I'm shooting
in the dark here, please edit as necessary):
_pick_variant -r difftype -c $cmd gnu=GNU extended=' -u ' unix -v
if [[ $difftype == extended ]]; then
_pick_variant -r difftype -c what \
solaris=SunOS extended $(whence $cmd)
case $difftype in
# The stuff now in the "if" part of _diff_options
# Your new section for solaris diff
# The current "else" part of _diff_options, with -u added
# The current "else" part of _diff_options
You could enhance this a little by adding "solaris=SunOS" to the first
of those two calls to _pick_variant, which allows the user to set the
"command" style in ":completion:*:diff:*:variant" context to something
that immediately returns "SunOS", thereby avoiding the second attempt.
} Hm. In investigating all this, I noticed that all the completion
} directories end up duplicated in $fpath, which seems to be done in
} compaudit. This seems to happen on 4.0.5 on Solaris, 4.1.1 on Solaris,
} and 4.1.1 on Linux, FWIW.
It *shouldn't* happen in compaudit; compaudit only tests things in the
fpath, it doesn't assign to it (except as a `local +h' parameter, which
should be reset when it goes out of scope).
Messages sorted by: