Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bash compgen -W compatibility patch



On Tue, 3 May 2011 14:27:07 -0400
Rocky Bernstein <rocky@xxxxxxx> wrote:
> On Tue, May 3, 2011 at 10:45 AM, Peter Stephenson
> <Peter.Stephenson@xxxxxxx>wrote:
> > _compgen_opt_words() {
> >  typeset -a words
> >  words=( ${~=1} )
> >  local find try
> >  find=${@[-1]}
> >
> 
> Probably simpler would be to use $2, i.e find=$2 I mistakenly had set
> find twice in the patch.

OK, I've committed this (we're in bash mode so should quote assignments
that don't want to be split)...

_compgen_opt_words() {
  typeset -a words
  words=( ${~=1} )
  local find="$2"
  results=(${(M)words[@]:#$find*})
}

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author