* _hosts and caching wrt zstyle
@ 2015-10-22 16:40 Stephane Chazelas
0 siblings, 0 replies; only message in thread
From: Stephane Chazelas @ 2015-10-22 16:40 UTC (permalink / raw)
To: Zsh hackers list
Hiya, in
} _hosts () {
} local expl _hosts tmp useip
} if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts
} then
} if (( $+_cache_hosts == 0 ))
} then
} typeset -gUa _cache_hosts
} local ipstrip='[:blank:]#[^[:blank:]]#'
} zstyle -t ":completion:${curcontext}:hosts" use-ip && useip=yes
} [[ -n $useip ]] && ipstrip=
} if (( ${+commands[getent]} ))
} then
} _cache_hosts=(${(s: :)${(ps:\t:)${(f)~~"$(_call_program hosts getent hosts 2>/dev/null)"}##${~ipstrip}}})
We retrieve the "use-ip" and "command" from zstyle based on the
current completion context, but then the caching seems to be
done regardless of that.
If I have:
zstyle ':completion::complete:ssh:*:hosts' command get-unix-hosts
zstyle ':completion::complete:ssh:*:hosts' use-ip false
zstyle ':completion::complete:rdesktop:*:hosts' command get-windows-hosts
zstyle ':completion::complete:rdesktop:*:hosts' use-ip true
Then, depending on whether I complete ssh or rdesktop first, the
cache will be seeded with unix or windows hosts.
What's the best way to avoid that?
--
Stephane
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-22 16:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 16:40 _hosts and caching wrt zstyle Stephane Chazelas
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).