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

Re: users@hosts completion



On Sun, 27 Jun 2004, Chris Johnson wrote:

> How can I setup users-hosts completion for my specified commands?

Unfortunately you can't set this up with zstyles only, because it relies 
on a special utility function called _combination which has to be called 
in the correct way from the function that generates potential matches for 
the command in question.

There's a generic function called _user_at_host that does this for the
special case of "user@hostname" arguments, but you still need another
function (which calls e.g. _arguments) to interpret the command line and
call _user_at_host when the cursor is in the correct argument position.

If it happens that your command has argument syntax very similar to one of 
the commands that already uses users-hosts completion, then you can tell
the completion system to treat completion for your command exactly the 
same as completion for that other command.  You do that with a "compdef"
command like so:

 compdef mynewcommand=telnet

Otherwise you'll have to delve into the writing of a new completion.



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