zsh-users
 help / color / mirror / code / Atom feed
* Re: new completion modifications
@ 2001-03-22 10:00 Sven Wischnowsky
  2001-03-22 15:34 ` Scott Lipcon
  2001-03-22 16:58 ` Bart Schaefer
  0 siblings, 2 replies; 17+ messages in thread
From: Sven Wischnowsky @ 2001-03-22 10:00 UTC (permalink / raw)
  To: zsh-users


Scott Lipcon wrote:

> I just upgraded from 3.0.x to a 3.1.9 version, and I'm starting to tweak the 
> new completions to work the way I like.  I have a few questions that I hope 
> aren't too basic.
> 
> Before, I had a few variables defined:
> 
> $hosts=(commonly used hosts)
> $sshhosts=(hosts I ssh to)
> $pages=(a list of URLs I visit)

You certainly mean `hosts=(...)'.  Written too much perl lately ? ;-)

> ...
> 
> I've got this mostly working by simply doing:
> 
> zstyle ':*' hosts $hosts
> zstyle ':*' hosts $sshhosts

The second call overrides the first one.

> First, which is the magic zstyle for a list of URLs?  It seems that 
> lynx/netscape use http:/(hosts)/ by default.

See the description of the `urls' tag and the `path' style in the
docs.

(I thought that were some script in the distribution helping to build
the directory structure the `path' style needs, but I can't find it
anymore.)

> Second, is there an easy way to limit my $hosts expansions to telnet, rlogin, 
> ftp, etc, and $sshhosts to ssh, scp, etc?  using the above zstyles, they are 
> all thrown in one completion basket.

Lots.  First, see the description of the `my-accounts' and
`other-accounts' tags and the `users-hosts' and `users-hosts-ports'
styles.

And then learn to make use of the first argument of `zstyle': it's a
pattern matching the context string in which the style should be used.
That string is described at the beginning of the `Completion System
Configuration' section.  Inter alia it contains the name of the
current command, so you could use:

  zstyle ':completion:*:*:ssh:*' hosts ...

to specify the host names to use for `ssh'.  Or:

  zstyle ':completion:*:*:(ssh|scp):*' hosts ...

for the hosts to use for both `ssh' and `scp'.

[see also Adam's message zsh-users:3692 ]

> Lastly, the default _rlogin  completion file doesn't work for me - we use the 
> kerberized version of rlogin, which takes the -x option:
> 
> % rlogin host<tab>
> 
> completes properly, as does rlogin -l user host<tab>.
> 
> however, 
> 
> % rlogin -x host<tab>  
> 
> does nothing.  
> 
> How can I add the -x flag to the rlogin completion definition, without 
> modifying the system file?  (kerberized rlogin seems to have lots of other 
> options that also aren't included - I only use -x however)

You can't without modifying the function.  But it's *very* simple.  At 
the beginning of _rlogin you see:

  _rlogin () {
    case "$service" in
    rlogin)
      _arguments -s \
        '-8[allow 8-Bit data]' \
        '-e-[specify escape character]:escape character:' \
        '-l[specify login user name]:login as:_rlogin_users' \
        ':remote host name:_rlogin_hosts'
      ;;

That part describes completion for `rlogin'.  Now just stick a line
describing the `-x' option into it, e.g.:

  _rlogin () {
    case "$service" in
    rlogin)
      _arguments -s \
        '-x[some kerberos thing]' \
        ...                          # the rest as in the original

Then put that modified function in your private zsh function directory 
and make sure it is before the standard completion directories in your
$fpath.  Then it will be automatically be used instead of the standard 
one.

If you want to help us and others you could try to find a (secure)
test if the `rlogin' supports kerberos-specific options.  If there is
such a test we could add it to the distributed _rlogin to make it
support these commands out-of-the-box.


To -workers: for some commands (including `rlogin', I think) we could
make the completion function more tolerant by adding `-A "-*"'s to the 
calls to _arguments.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: new completion modifications
@ 2001-03-23 14:07 Sven Wischnowsky
  0 siblings, 0 replies; 17+ messages in thread
From: Sven Wischnowsky @ 2001-03-23 14:07 UTC (permalink / raw)
  To: zsh-users


Scott Lipcon wrote:

> ...
> 
> While I can see that this directory structure is useful if you have 
> hundreds of URLs, many from the same hosts, it really isn't great for me -
> I probably have 5 or 10 URLs that I'd like to complete in this manner, all
> unique in the host portion (so I'd like to be able to type enough of the host
> to identify the url, and have the whole thing expand on a tab)

This seems reasonable.  Question to everyone (and -workers in
particular): should we add a `urls' style, comparable to `hosts' and
such, that just gives a bunch of strings to complete as urls?
Probably taking precedence over the other things (different from
`hosts' and friends).

> ...
> 
> This seems to work on my system:
> 
> % /usr/bin/rlogin -x 2>&1 | egrep '(illegal|invalid) option' > /dev/null && echo kerberized
> % /usr/local/bin/rlogin -x 2>&1 | egrep '(illegal|invalid) option' > /dev/null && echo kerberized
> kerberized
> %

Hm, I had hoped there were some `--help' option saying something about 
kerberos.

Then we'd like to know about the other special options and which other 
commands are affected (rsh? rcp?).  With that we could integrate it
into _rlogin (does any of the -workers have a kerberos-rlogin?).


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 17+ messages in thread
* new completion modifications
@ 2001-03-22  3:58 Scott Lipcon
  2001-03-22 10:21 ` Oliver Kiddle
  0 siblings, 1 reply; 17+ messages in thread
From: Scott Lipcon @ 2001-03-22  3:58 UTC (permalink / raw)
  To: zsh-users

Hello,

I just upgraded from 3.0.x to a 3.1.9 version, and I'm starting to tweak the 
new completions to work the way I like.  I have a few questions that I hope 
aren't too basic.

Before, I had a few variables defined:

$hosts=(commonly used hosts)
$sshhosts=(hosts I ssh to)
$pages=(a list of URLs I visit)

and used:

compctl -k hosts telnet rlogin ftp ncftp ping traceroute 
compctl -k sshhosts ssh ssh1 ssh2
compctl -k pages lynx netscape netscape4

(along with some more advanced scp compctls)

I've got this mostly working by simply doing:

zstyle ':*' hosts $hosts
zstyle ':*' hosts $sshhosts

First, which is the magic zstyle for a list of URLs?  It seems that 
lynx/netscape use http:/(hosts)/ by default.

Second, is there an easy way to limit my $hosts expansions to telnet, rlogin, 
ftp, etc, and $sshhosts to ssh, scp, etc?  using the above zstyles, they are 
all thrown in one completion basket.

Lastly, the default _rlogin  completion file doesn't work for me - we use the 
kerberized version of rlogin, which takes the -x option:

% rlogin host<tab>

completes properly, as does rlogin -l user host<tab>.

however, 

% rlogin -x host<tab>  

does nothing.  

How can I add the -x flag to the rlogin completion definition, without 
modifying the system file?  (kerberized rlogin seems to have lots of other 
options that also aren't included - I only use -x however)


Thanks,

Scott 







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

end of thread, other threads:[~2001-03-24 17:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-22 10:00 new completion modifications Sven Wischnowsky
2001-03-22 15:34 ` Scott Lipcon
2001-03-22 16:01   ` Bart Schaefer
2001-03-22 16:28     ` Scott Lipcon
2001-03-22 21:08       ` Bart Schaefer
2001-03-22 21:50         ` Scott Lipcon
2001-03-23 16:09           ` Bart Schaefer
2001-03-23 16:27             ` Scott Lipcon
2001-03-23 17:14               ` Bart Schaefer
2001-03-23 18:37                 ` Scott Lipcon
2001-03-23 18:54                   ` Bart Schaefer
2001-03-23 20:16                     ` Scott Lipcon
2001-03-24 17:22                       ` Bart Schaefer
2001-03-22 16:58 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2001-03-23 14:07 Sven Wischnowsky
2001-03-22  3:58 Scott Lipcon
2001-03-22 10:21 ` Oliver Kiddle

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