From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6762 invoked from network); 13 Sep 1999 13:45:38 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Sep 1999 13:45:38 -0000 Received: (qmail 16573 invoked by alias); 13 Sep 1999 13:45:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7804 Received: (qmail 16566 invoked from network); 13 Sep 1999 13:45:28 -0000 Date: Mon, 13 Sep 1999 15:45:16 +0200 (MET DST) Message-Id: <199909131345.PAA21304@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Sven Wischnowsky's message of Mon, 13 Sep 1999 10:34:24 +0200 (MET DST) Subject: Re: Completion listing of command options ( Re: Size of select listing?) I wrote: > Andrej Borsenkow wrote: > > ... > > > Still, _arguments, even with option_prefix set, behaves funnily: > > > > patch TAB -> completes files. It's O.K. > > patch foo TAB -> again files. Still O.K. > > patch foo bar TAB - lists all options! But, patch can have only two arguments - > > so, I'd expected some message about it. > > The fact that you only get options as possible matches even though you > normally don't see them could be taken as a (strong) hint for that, > couldn't it? However, it wouldn't be hard to add either `:no more arguments:' > descriptions to the calls of `_arguments' or build this into > `_arguments'. This makes `_arguments' spit out a message saying `no more arguments' in such command line positions. Is that OK for everyone? Bye Sven P.S.: I haven't tested it with all completion function (you may have guessed that already ;-), but this message can also be used as a measure for the quality of the uses of `_arguments' -- if it doesn't print the message in places where no more normal argument is understood by the program, the descriptions to `_arguments' are probably wrong. P.P.S.: Not so long ago we were happy if TAB would complete the right files and things like that. Nowadays... diff -u oldcompletion/Base/_arguments Completion/Base/_arguments --- oldcompletion/Base/_arguments Mon Sep 13 13:58:09 1999 +++ Completion/Base/_arguments Mon Sep 13 15:39:19 1999 @@ -8,7 +8,7 @@ local args rest ws cur nth def nm expl descr action opt arg tmp xor local single uns ret=1 aret soptseq soptseq1 sopts prefix _line odescr local beg optbeg argbeg nargbeg inopt inrest fromrest cmd="$words[1]" -local matched curopt +local matched curopt noargs # Associative arrays used to collect information about the options. @@ -625,6 +625,10 @@ fromrest=yes [[ -n "$inrest" ]] && opt='' fi + if [[ -z "$def" ]]; then + _message 'no more arguments' + noargs=yes + fi fi # In any case, we have to complete option names here, but we may @@ -814,7 +818,7 @@ # Probably add the option names. if [[ -n "$opt" && - ( ( nm -eq compstate[nmatches] && -z "$aret" ) || + ( ( ( nm -eq compstate[nmatches] || -n "$noargs" ) && -z "$aret" ) || -z "$compconfig[option_prefix]" || "$compconfig[option_prefix]" = *\!${cmd}* || "$PREFIX" = [-+]* ) ]]; then -- Sven Wischnowsky wischnow@informatik.hu-berlin.de