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

Re: Completion alias

=?UTF-8?Q?J=C3=B6rg?= Sommer wrote:
> But how can I use this for a completion of a command with an argument,
> i.e. agi should have the same completion as 'agt-get install'

That would require some rewriting of _apt.  It's easy to specify
that a function should behave like apt-get:

compdef agi=apt-get

but without support in _apt there's no way of telling it to behave
as if the "install" argument is present.

I came up with a way of doing this for the Perforce completion:

  compdef _perforce p4cvsmap=p4-files

says that "p4cvsmap ..." behaves like "p4 files ...".  However, it's
not trivial to bolt this method onto an existing completion unless
it already has separate despatchers for subcommands.  Furthermore,
_apt uses the regex handling which makes it even more difficult.

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

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

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