* trying completion of varying data
@ 2002-06-01 3:50 Andy Spiegl
2002-06-01 14:33 ` Clint Adams
2002-06-01 20:26 ` Bart Schaefer
0 siblings, 2 replies; 5+ messages in thread
From: Andy Spiegl @ 2002-06-01 3:50 UTC (permalink / raw)
To: ZSH User List
Hi,
I am trying to write a completion rule for xvncviewer that only completes
the hosts that are actually turned on in my subnet. So everytime before
showing me the possible completions it has to check for running hosts.
This second part isn't so hard, e.g. like this:
foreach ip (`nmblookup "*" | cut -f1 -d" " | grep "^[0-9.]*$"`)
host $ip | grep Name: | cut -d" " -f2
end
(sorry, I'm sure you guys would do that better and faster)
But then how do I get zsh to complete only these hostnames???
Looking at these working examples:
zstyle ':completion:*:*:mpg123:*' file-patterns \
'*.(mp3|MP3):mp3\ files *(-/):directories'
zstyle ':completion:*:processes' command 'ps -au$USER'
I tried
zstyle ':completion:*:*:xvncviewer:*' command 'show.active.pcs'
(where show.active.pcs does the above)
but it doesn't even try to call the show.active.pcs script.
Please give me a hint what I'm doing wrong or any other suggestions.
Thanks!
Andy.
--
http://peru.spiegl.de Our project
http://radiomaranon.org.pe Radio Marañón, Jaén, Perú
o _ _ _
------- __o __o /\_ _ \\o (_)\__/o (_) -o)
----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\
---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"We're going to turn this team around 360 degrees."
(Jason Kidd, upon his drafting to the Dallas Mavericks)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trying completion of varying data
2002-06-01 3:50 trying completion of varying data Andy Spiegl
@ 2002-06-01 14:33 ` Clint Adams
2002-06-02 3:44 ` Andy Spiegl
2002-06-01 20:26 ` Bart Schaefer
1 sibling, 1 reply; 5+ messages in thread
From: Clint Adams @ 2002-06-01 14:33 UTC (permalink / raw)
To: ZSH User List
> I tried
> zstyle ':completion:*:*:xvncviewer:*' command 'show.active.pcs'
> (where show.active.pcs does the above)
> but it doesn't even try to call the show.active.pcs script.
I think you want something more along the lines of
zstyle ':completion:*:xvncviewer:*:hosts' hosts $(show.active.pcs)
or
zstyle -e ':completion:*:xvncviewer:*:hosts' hosts 'reply=( $(show.active.pcs) )'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trying completion of varying data
2002-06-01 3:50 trying completion of varying data Andy Spiegl
2002-06-01 14:33 ` Clint Adams
@ 2002-06-01 20:26 ` Bart Schaefer
1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2002-06-01 20:26 UTC (permalink / raw)
To: Andy Spiegl, zsh-users
To add to what Clint suggested ...
On May 31, 10:50pm, Andy Spiegl wrote:
}
} Looking at these working examples:
} zstyle ':completion:*:*:mpg123:*' file-patterns \
} '*.(mp3|MP3):mp3\ files *(-/):directories'
}
} zstyle ':completion:*:processes' command 'ps -au$USER'
}
} I tried
} zstyle ':completion:*:*:xvncviewer:*' command 'show.active.pcs'
} (where show.active.pcs does the above)
Don't just look at the examples, look at the doc. Not all contexts use
all styles. In particular, the "command" style is only used to override
the default match-generating command for completions that already use
such a command; it won't magically cause an arbitrary completion to start
using a command to generate the matches.
--
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] 5+ messages in thread
* Re: trying completion of varying data
2002-06-01 14:33 ` Clint Adams
@ 2002-06-02 3:44 ` Andy Spiegl
2002-06-02 5:58 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Andy Spiegl @ 2002-06-02 3:44 UTC (permalink / raw)
To: ZSH User List
Hi again,
> zstyle ':completion:*:xvncviewer:*:hosts' hosts $(show.active.pcs)
This is already great, but I just noticed that there's one tiny problem
left with it: zsh seems to cache the output of show.active.pcs, but of
course I want it to adapt itself to the current situation thus showing only
the pcs that are turned on at the moment.
I tried to turn off all completion caching options I could find in the
manual, but still the same result. Could you help me again, please?
Thanks so much,
Andy.
--
http://peru.spiegl.de Our project
http://radiomaranon.org.pe Radio Marañón, Jaén, Perú
o _ _ _
------- __o __o /\_ _ \\o (_)\__/o (_) -o)
----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\
---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A short saying often contains much wisdom. -- Sophocles
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: trying completion of varying data
2002-06-02 3:44 ` Andy Spiegl
@ 2002-06-02 5:58 ` Bart Schaefer
0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2002-06-02 5:58 UTC (permalink / raw)
To: Andy Spiegl; +Cc: ZSH User List
On Sat, 1 Jun 2002, Andy Spiegl wrote:
> > zstyle ':completion:*:xvncviewer:*:hosts' hosts $(show.active.pcs)
>
> This is already great, but I just noticed that there's one tiny problem
Clint already gave you the answer:
zstyle -e ':completion:*:xvncviewer:*:hosts' hosts \
'reply=( $(show.active.pcs) )'
> I tried to turn off all completion caching options I could find
This doesn't have anything to do with caching. It has to do with whether
or not the expression $(show.active.pcs) is inside single quotes.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-06-02 5:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-01 3:50 trying completion of varying data Andy Spiegl
2002-06-01 14:33 ` Clint Adams
2002-06-02 3:44 ` Andy Spiegl
2002-06-02 5:58 ` Bart Schaefer
2002-06-01 20:26 ` Bart Schaefer
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).