zsh-users
 help / color / mirror / code / Atom feed
* ssh compctl
@ 1999-07-19 10:54 Bek Oberin
  1999-07-19 11:45 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bek Oberin @ 1999-07-19 10:54 UTC (permalink / raw)
  To: Zsh Users


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?

This is what I have:

# ssh, users-I-ssh-as and hosts
hosts=(tertius.net.au www.tertius.net.au dora.tertius.net.au mycroft.tertius.net.au localhost news.netizen.com.au www.netizen.com.au netizen.com.au hiro.netizen.com.au juanita.netizen.com.au reason.netizen.com.au)
users=(gossamer bekj root)
compctl -k users -S'@' -x 'n[1,@]' -k hosts -- ssh


How do I put alternates in?  Surce it's in the docos, but my eyes
are beginning to glaze over :)

bekj

-- 
: --Hacker-Neophile-Eclectic-Geek-Grrl-Queer-Disabled-Boychick--
: gossamer@tertius.net.au   http://www.tertius.net.au/~gossamer/
: The dark minute the caterpillar calls the end of the world is
: the sun-filled moment the butterfly calls the beginning.  -- ??


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ssh compctl
  1999-07-19 10:54 ssh compctl Bek Oberin
@ 1999-07-19 11:45 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-07-19 11:45 UTC (permalink / raw)
  To: Zsh Users

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-07-19 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-19 10:54 ssh compctl Bek Oberin
1999-07-19 11:45 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).