Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ssh compctl
- X-seq: zsh-users 2446
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: ssh compctl
- Date: Mon, 19 Jul 1999 13:45:18 +0200
- In-reply-to: "Bek Oberin"'s message of "Mon, 19 Jul 1999 20:54:36 DFT." <19990719205436.F29765@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
Bek Oberin wrote:
>
> I want to get ssh to complete either user@host or host. I've figured
> out the former, with much rtfm'ing, but not the latter ... how can I
> give it alternates?
You're supposed to be able to do it with `+', as follows:
compctl -k users -S @ -x 'n[1,@]' -k hosts -- + -k hosts ssh
Maybe the section in the FAQ is clearer about alternatives than the manual,
but maybe not.
The new completion (Completion/User/_rlogin) should probably do this better
too.
--- Completion/User/_rlogin~ Wed Jul 14 13:57:32 1999
+++ Completion/User/_rlogin Mon Jul 19 13:42:54 1999
@@ -1,9 +1,15 @@
#compdef rlogin rsh ssh
-if [[ CURRENT -eq 2 ]]; then
- _hosts
+if [[ CURRENT -eq 2 ]];
+ if compset -P 1 '*@'; then
+ _hosts
+ else
+ local nm=${compstate[nmatches]}
+ _hosts
+ [[ nm -eq compstate[nmatches] ]] && compgen -S @ -u
+ fi
elif [[ CURRENT -eq 3 ]]; then
compadd - -l
else
- compgen -u
+ compgen -S @ -u
fi
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author