From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25597 invoked from network); 21 Aug 2001 13:50:31 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Aug 2001 13:50:31 -0000 Received: (qmail 13465 invoked by alias); 21 Aug 2001 13:50:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15671 Received: (qmail 13452 invoked from network); 21 Aug 2001 13:50:20 -0000 Message-ID: <20010821135010.87423.qmail@web10405.mail.yahoo.com> Date: Tue, 21 Aug 2001 06:50:10 -0700 (PDT) From: Felix Rosencrantz Subject: Re: New options & arguments processing system for ZSH To: martin.ebourne@arcordia.com, zsh-workers@sunsite.auc.dk In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'll try to be a little more descriptive. When completing, like so: prompt% yes - ---- 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 - ---- 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] [ ...] 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 , --lines= 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 , --sleep= Pause for number of seconds between each echo # --sleep | -s : posinteger * help="__Pause for number of seconds between each echo" Arguments: [ ...] 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/