From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Completion listing of command options ( Re: Size of select listing?)
Date: Mon, 13 Sep 1999 15:45:16 +0200 (MET DST) [thread overview]
Message-ID: <199909131345.PAA21304@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Mon, 13 Sep 1999 10:34:24 +0200 (MET DST)
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
next reply other threads:[~1999-09-13 13:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-13 13:45 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-09-14 9:56 Sven Wischnowsky
1999-09-13 8:34 Sven Wischnowsky
1999-09-09 15:19 Size of select listing? Andrej Borsenkow
1999-09-10 15:23 ` Oliver Kiddle
1999-09-10 15:45 ` Completion listing of command options (Re: Size of select listing?) Bart Schaefer
1999-09-10 15:54 ` Completion listing of command options ( " Andrej Borsenkow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199909131345.PAA21304@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).