Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion function directories
- X-seq: zsh-workers 10998
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Completion function directories
- Date: Fri, 28 Apr 2000 11:07:24 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Thu, 27 Apr 2000 15:09:16 -0700
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Apr 27, 11:59am, Andrej Borsenkow wrote:
>
> ...
>
> > I believe, in all cases when it is
> > possible we need automatic test for GNU utilities so, that completion
> > really works "out of the box". And only when it's not possible - last
> > resort like styles for particular command.
>
> Following the same sort of suggestion as above, we'd have something like
>
> _detect_gnu () {
> (( $+_is_gnu )) || typeset -gA _is_gnu
> if (( ! $+_is_gnu[$1] ))
> then
> if [[ $(_call version "$@" </dev/null 2>/dev/null) = *GNU* ]]
> then
> _is_gnu[$1]=yes
> else
> _is_gnu[$1]=
> fi
> fi
> [[ $_is_gnu[$1] = yes ]]
> }
>
> And then _make would use
>
> if _detect_gnu $words[1] -v -f /dev/null; then
>
> and _diff_options would use
>
> if _detect_gnu $cmd -v; then
>
> and so on for any other completion functions that needed to notice GNU.
Hmhm. Does anyone see if and how we could turn this into a more
generic `_check_type' function? Something like:
local type
_check_type type $words[1] ... # args?
case $type in
GNU) ...
AIX) ...
*) ...
esac
Would that be possible withou making _check_type too expensive?
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author