zsh-workers
 help / color / mirror / code / Atom feed
* The group-order and tag-order styles
@ 2001-06-13 11:45 Bart Schaefer
  2001-06-13 12:53 ` Sven Wischnowsky
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2001-06-13 11:45 UTC (permalink / raw)
  To: zsh-workers

Given the following always in effect:

zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''

Fiddling with ssh completion (see zsh-users thread) I now have this:

zstyle ':completion:*:ssh:*' tag-order 'hosts:-domain hosts:-ipaddr *'
zstyle ':completion:*:ssh:*' group-order \
    hosts:-domain:domains users 'hosts:-ipaddr:IP addresses' \*
zstyle ':completion:*:ssh:*:hosts-domain' ignored-patterns '<->.<->.<->.<->'
zstyle ':completion:*:ssh:*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->'
zstyle -e ':completion:*:ssh:*' hosts 'reply=(
    ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
		     /dev/null)"}%%[# ]*}//,/ }
    ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
    )'

With just the last of these styles, completion after `ssh' lists two groups:
hosts first, then users.  What I want to see is three groups:  hosts by
domain name, then users, then hosts by IP address.  Adding the other styles
successfully splits the result into three groups, but the users are always
listed first.  Also, the explanation strings (`domains' and `IP addresses')
from the group-order style are never shown in the listing.

What am I missing?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: The group-order and tag-order styles
  2001-06-13 11:45 The group-order and tag-order styles Bart Schaefer
@ 2001-06-13 12:53 ` Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-06-13 12:53 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> ...
> 
> With just the last of these styles, completion after `ssh' lists two groups:
> hosts first, then users.  What I want to see is three groups:  hosts by
> domain name, then users, then hosts by IP address.  Adding the other styles
> successfully splits the result into three groups, but the users are always
> listed first.  Also, the explanation strings (`domains' and `IP addresses')
> from the group-order style are never shown in the listing.
> 
> What am I missing?

The group-order style takes just group names as values, no fancy
aliasing or description stuff, that comes with the tag-order style.
Like so:

  zstyle ':completion:*:ssh:*' tag-order \
    'hosts:-domain:domains hosts:-ipaddr:IP\ addresses *'
  zstyle ':completion:*:ssh:*' group-order \
    hosts-domain users hosts-ipaddr
  zstyle ':completion:*:ssh:*:hosts-domain' ignored-patterns '<->.<->.<->.<->'
  zstyle ':completion:*:ssh:*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->'
  zstyle -e ':completion:*:ssh:*' hosts 'reply=(
    ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
		     /dev/null)"}%%[# ]*}//,/ }
    ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
    )'

Which gives me what you want.


Bye
  Sven


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


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

end of thread, other threads:[~2001-06-13 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-13 11:45 The group-order and tag-order styles Bart Schaefer
2001-06-13 12:53 ` Sven Wischnowsky

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