zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh workers mailing list <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: improvement to user@host completions
Date: Sun, 26 Sep 1999 17:02:33 +0200	[thread overview]
Message-ID: <9909261502.AA30070@ibmth.df.unipi.it> (raw)
In-Reply-To: "Adam Spiers"'s message of "Sun, 26 Sep 1999 15:17:23 DFT." <19990926151723.F1246@thelonious.new.ox.ac.uk>

Adam Spiers wrote:
> This patch harnesses the power of Tanaka's _combination in _rlogin, _ssh
> and other functions.
> 
> The user should put something similar to the following in his .zshrc:
>
> ...
> 
> and then a whole family of commands will then intelligently complete
> (user, host) pairs, in both `-l user host' (where appropriate) and
> `user@host' style.  Currently the rlogin and ssh family are affected,
> and also ytalk and finger.

This is an excellent idea, but it could do with some documentation.
Currently that just means comments in the appropriate functions.  (Not all
functions have them, of course, but here it's crucial that users know
they're supposed to set some variables.)  Ideally, the functions _ssh_users
and _ssh_hosts should be tested for existence before they're defined
so that users can define their own.  There were some typos which I've
fixed.

However (long digresion), in the long run I'm hoping for some
context-sensitive help.  Something like _description would be used to add
it.  It would give a message something like this (I've assumed my
suggestion for tags and locators, but it doesn't have to depend on that at
all):

  % tar xvzf ^X^H
  Current completion context is _tar->tar-archive.
  _tar performs completion for the tar command, including GNU tar extension.
  Possible subcontexts are:
    option, tarfile, content, file
  Subcontext tar-archive completes a tar archive.  By default this
  is a file ending in *.tar, although this can be modified by the GNU -z
  option to search for *.tar.gz.
  Tags used:
    glob:     use specific pattern to find a file
    path:     directory path to a file
    anyfile:  use any file as default if glob tag fails.

or in this case

  % ssh ^X^H
  Current completion context is _ssh->userhost.
  _ssh performs completion for ssh and related commands such as scp.
  Possible subcontexts are:
    option forward command userhost
  Subcontext userhost completes either hostnames, or user@host pairs.
  For this to work best the arrays my_accounts and other_accounts
  should be set; each contains entries in the form user:[host] where
  host defaults to the current host, or {user1,user2}:host for
  multiple users on the same host.  You may also set <cmd>_accounts
  for each specific <cmd> such as ssh.
  Tags used:
    userat:  complete username for the form user@host
    host:    complete an Internet hostname.

I've simplified this because in fact there is a separate function
_tar_archive, and I haven't worked out how that fits in to this scheme.  To
remind you: my idea about tags (and Sven was no doubt thinking along
similar lines) was that they could allow you to set priorities for
completions, e.g. you could say you only wanted user@ to be completed if
all the hosts failed.  Then you could extend the tags to set priorities for
my_accounts and other_accounts.  There could also be an option so that
typing ^D multiple times toggles between showing the completion list and
showing the context-sensitive help.  This is all Zukunftsmusik.

> P.S. Why does cvs diff not put the full path in the +++ line for newly
> added files?  And why doesn't patch understand `Index:' ?

Did you call cvs diff from the top level directory?  I think patch only
recognises `Index:' on the line immediately before the hunk it refers to.
I don't know CVS well enough to tell you why it didn't happen.

--- Completion/User/_users_on.c2	Sun Sep 26 15:47:42 1999
+++ Completion/User/_users_on	Sun Sep 26 16:33:01 1999
@@ -1,9 +1,9 @@
-#autoload write
+#compdef write
 
 local expl
 
 if which users >/dev/null; then
-  _description expl users logged on
+  _description expl 'users logged on'
   compadd "$@" "$expl[@]" - $(users) && return 0
 else
   # Other methods of finding out users logged on should be added here

-- 
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-09-26 15:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-26 14:17 Adam Spiers
1999-09-26 15:02 ` Peter Stephenson [this message]
1999-09-26 16:57   ` Bart Schaefer
1999-09-26 23:28   ` Adam Spiers
1999-09-26 17:29 ` CVS and patch (again; Re: PATCH: improvement to user@host completions) Bart Schaefer
1999-09-27  7:54 ` PATCH: improvement to user@host completions Tanaka Akira
1999-09-27 13:24   ` PATCH: missing _user@host Adam Spiers
1999-09-27 14:43     ` Ollivier Robert
1999-09-27 15:58       ` Ollivier Robert
1999-09-29 18:56         ` Adam Spiers
1999-10-11 11:22 PATCH: improvement to user@host completions Sven Wischnowsky

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=9909261502.AA30070@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@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).