Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: _netscape
- X-seq: zsh-workers 11532
 
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx
 
- Subject: Re: PATCH: Re: _netscape
 
- Date: Tue, 23 May 2000 15:58:41 +0200 (MET DST)
 
- In-reply-to: Oliver Kiddle's message of Tue, 23 May 2000 14:50:04 +0100
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
Oliver Kiddle wrote:
> Sven Wischnowsky wrote:
> 
> > > > Basically, what a helper function needs to do is
> > > > take the suffix passed to it and when it is completing a final component
> > > > of itself, it should pass any suffix it wants with the one passed to it
> > > > appended. Pulling out -S options from "$@" is going to look messy
> > > > without some special handling at a lower level somewhere.
> 
> > This is so simple to write that I think it's worth adding. So, this
> > adds the -E option to zparseopts that can be used to extract options
> > from the positional parameters. When combined with -D, the options
> > described are actually removed from $*.
> 
> On the basis that compadd does only use the first -S option that it is
> passed, being able to remove an option is not what is wanted: what is
> wanted is a way to separate the first -S option and have it available in
> a parameter.
Ever had a look at zparseopts?
  foo() {
    local suffix
    zparseopts -D -E 'S:=suffix'
    print "user-supplied suffix: ${suffix:-<none>}"
    print "remaining arguments:  $*"
  }
  % foo -J group -S test -X format other arguments
  user-supplied suffix: -S test
  remaining arguments:  -J group -X format other arguments
  % foo -J group -X format no suffix here
  user-supplied suffix: <none>
  remaining arguments:  -J group -X format no suffix here
What else do you need?
Bye
 Sven
--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author