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

Re: Using the same completion function for various commands



On Mon, 6 Dec 2010 16:03:51 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:

> 2010/12/6 JÃrÃmie Roquet <arkanosis@xxxxxxxxx>:
> > Hi,
> >
> > 2010/12/6 Mikael Magnusson <mikachu@xxxxxxxxx>:
> >> You can also do this in your .zshrc instead of in the completer if
> >> you wish, just write
> >> compdef _foo -p 'foo_*'
> >>
> >> At least that's what the documentation says, it doesn't seem to
> >> work that well.
> >
> > It works fine for me with 4.3.10, did I miss something?
> 
> When i tried compdef _du -p foo_\*, i only got single-letter options
> completed.
> 

That means it's working perfectly.  It's hitting this line at the top of
_du

  _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file

and deciding, quite reasonably in my opinion, that foo_\* is not a GNU
variant of du.  So it's going to the other branch, where the options are
simpler.

-- 
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