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

Re: users@hosts completion

Bart Schaefer wrote:

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


> 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

   This works beautifully.  My command is just a wrapper to scp, written
to help prevent overwriting of files.  Too many times I've omitted the
remote destination argument--i.e., scp source1 source2--and overwritten
source2 with source1.  (I'm not aware of any interactive option for scp like there is for cp.)

   So, this command lends itself perfectly to compdef.  I am in your
debt.  Thank you!

Chris Johnson

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