From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20119 invoked from network); 28 Apr 2000 09:09:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Apr 2000 09:09:04 -0000 Received: (qmail 28893 invoked by alias); 28 Apr 2000 09:08:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10998 Received: (qmail 28877 invoked from network); 28 Apr 2000 09:08:58 -0000 Date: Fri, 28 Apr 2000 11:07:24 +0200 (MET DST) Message-Id: <200004280907.LAA20260@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Thu, 27 Apr 2000 15:09:16 -0700 Subject: Re: Completion function directories 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) = *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@informatik.hu-berlin.de