zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: Zsh Users <zsh-users@sunsite.auc.dk>
Subject: Re: ssh compctl
Date: Mon, 19 Jul 1999 13:45:18 +0200	[thread overview]
Message-ID: <9907191145.AA18364@ibmth.df.unipi.it> (raw)
In-Reply-To: "Bek Oberin"'s message of "Mon, 19 Jul 1999 20:54:36 DFT." <19990719205436.F29765@tertius.net.au>

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


      reply	other threads:[~1999-07-19 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-19 10:54 Bek Oberin
1999-07-19 11:45 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9907191145.AA18364@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).