From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9682 invoked from network); 23 Aug 1999 10:54:33 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 23 Aug 1999 10:54:32 -0000 Received: (qmail 17863 invoked by alias); 23 Aug 1999 10:54:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7464 Received: (qmail 17856 invoked from network); 23 Aug 1999 10:54:25 -0000 To: zsh-workers@sunsite.auc.dk Subject: Re: PATCH: completion References: <199908230932.LAA02718@beta.informatik.hu-berlin.de> MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 23 Aug 1999 19:54:11 +0900 In-Reply-To: Sven Wischnowsky's message of "Mon, 23 Aug 1999 11:32:16 +0200 (MET DST)" Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) In article <199908230932.LAA02718@beta.informatik.hu-berlin.de>, Sven Wischnowsky writes: > I don't agree here -- do you know of any command that accepts a `--' > option which gets its argument in the next word? If so, I think that > command shouldn't do that. GNU getopt_long supports the style. getopt_long(3): The getopt_long() function works like getopt() except that it also accepts long options, started out by two dashes. Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option. A long option may take a parameter, of the form --arg=param or --arg param. So, many GNU commands accept that. > (I think you mean completion functions, the term `completer' refers to > those top-level thingies like `_complete'.) Wow. Yes. > No, it shouldn't -- there is one string resulting from the expansion, > even it is the empty string. I see. > What exactly doesn't work with single-letter option because of this? > (I'm a bit too lazy to search ;-) I guess that this can be avoided by > adding a ${...:#} somewhere. Z(2):akr@is27e1u11% Src/zsh -f is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst is27e1u11% compconf group_matches=yes is27e1u11% compconf message_format='%d' is27e1u11% compconf description_format='%d' is27e1u11% _tst () { _arguments -s '-a' '-b' } is27e1u11% set -x is27e1u11% tst -a ... +_arguments:370> unset opts[-a] dopts[] odopts[] ... +_arguments:385> compadd -J option -X option -Q -y ( -b ) - -ab -a -a ... option -b It should complete "b" immediately. This is because "-a" in compadd arguments. It is the result of expansion of "dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]" and "odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]". Z(2):akr@is27e1u11% Src/zsh -f is27e1u11% typeset -A opts is27e1u11% opts[-a]= is27e1u11% opts[-b]= is27e1u11% print -lr - "A${(@)^opts[(I)xx]}B" AB is27e1u11% print -lr - "A${${(@)^opts[(I)xx]}:#}B" AB is27e1u11% print -lr - "A${(@)${(@)^opts[(I)xx]}:#}B" AB is27e1u11% Hm. -- Tanaka Akira