From: Felix Rosencrantz <f_rosencrantz@yahoo.com>
To: martin.ebourne@arcordia.com, zsh-workers@sunsite.auc.dk
Subject: Re: New options & arguments processing system for ZSH
Date: Tue, 21 Aug 2001 06:50:10 -0700 (PDT) [thread overview]
Message-ID: <20010821135010.87423.qmail@web10405.mail.yahoo.com> (raw)
In-Reply-To: <OF37045DDA.B648BDA3-ON80256AAE.003870CD@uk.jpmorgan.com>
I'll try to be a little more descriptive. When completing, like so:
prompt% yes -<TAB>
---- option
--lines --sleep -l -s -- positive integer number
--escape --no-escape -E -h
--help --no-newline -e -n
There is no help on what the options do. There's nothing that says -l means
"Output only count times". Actually, there is sort of a problem with the
listing, since it says that the --lines,-l,-s,--sleep options are the same
because of the new "equivalence matching".
I created a new version of yes, called yes2, which I've attached. It behaves
more like what I would like to see during completion, as such:
prompt% yes2 -<TAB>
---- option
--escape -e -- __Interpret escape characters as for echo (default unless
--help -h -- __Provide help
--lines -l -- __Output only count times
--no-escape -E -- __Prevent interpretation of escape characters
--no-newline -n -- __Suppress output of automatic newline
--sleep -s -- __Pause for number of seconds between each echo
But notice the duplication of the option explanation via the '* help="..."'
syntax. (I added the double underscores, just to make sure that is where the
text was coming from.)
The way I read your mail, though, is that the yes2 output should be coming
from the original "yes" script. So there might be a problem somewhere,
or I just didn't understand you.
>Since _arguments doesn't decode values for use I don't see how that would
>work.
If you use a state action, _arguments puts information in the opt_args
associative array. I think it could be useful if there was a little
more control how parsed values are stored like provided by parse_opts.
-FR.
----------BEGIN yes2
local -A opts
parse_opts - opts -- "$argv[@]" <<'EOF' || return 1
Description:
Repeatedly print a string
Usage:
yes2 [options] [<text> ...]
Options:
-e, --escape Interpret escape characters as for echo (default
unless
the BSD_ECHO option is set)
# [echoopt] += --escape | -e : constant=-e *
help="__Interpret escape characters as for echo (default unless the BSD_ECHO
option is set)"
-E, --no-escape Prevent interpretation of escape characters
# [echoopt] += --no-escape | -E : constant=-E *
help="__Prevent interpretation of escape characters"
-h, --help Provide this help
# --help | -h * help="__Provide help"
-l <count>, --lines=<count> Output only count times
# --lines | -l : posinteger * help="__Output only count
times"
-n, --no-newline Suppress output of automatic newline
# [echoopt] += --no-newline | -n : constant=-n *
help="__Suppress output of automatic newline"
-s <seconds>, --sleep=<seconds>
Pause for number of seconds between each echo
# --sleep | -s : posinteger * help="__Pause for number of
seconds between each echo"
Arguments:
[<text> ...] Optional text to print. Defaults to 'yes'
# [text] += [*] text
EOF
# Output as required
while (( ${opts[lines]:-1} ))
do
echo $=opts[echoopt] ${opts[text]:-yes}
(( opts[sleep] )) && sleep $opts[sleep]
(( opts[lines] && opts[lines]-- ))
done
----------END yes2
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
next prev parent reply other threads:[~2001-08-21 13:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-20 10:42 martin.ebourne
2001-08-21 13:50 ` Felix Rosencrantz [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-08-21 14:07 martin.ebourne
2001-08-24 6:13 ` Felix Rosencrantz
2001-08-20 11:17 martin.ebourne
2001-08-20 6:53 Felix Rosencrantz
2001-08-20 7:06 ` Borsenkow Andrej
[not found] <OF653C664E.8AB47B26-ON80256AAB.004AC761@uk.jpmorgan.com>
2001-08-19 5:40 ` Bart Schaefer
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=20010821135010.87423.qmail@web10405.mail.yahoo.com \
--to=f_rosencrantz@yahoo.com \
--cc=martin.ebourne@arcordia.com \
--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).