Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_hosts and caching wrt zstyle
- X-seq: zsh-workers 36918
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: _hosts and caching wrt zstyle
- Date: Thu, 22 Oct 2015 17:40:34 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=GH6V/z0SOFECJNZac9z/ip1P6h14rT/sOqquE4H/fCg=; b=yfAtJomgpEk+4Se7XX1N52i9w7iLmzrMl4PjALAMtHBydaTF0SInZ2uKiOJ7dOzKnP cp4vTjZy9bWOxm5h7ak8MzsrFEPr6kuYfQPhAlzpEBYcmz7cm6imiaOerc4O6+Wnfr2R kMjraPNQFAbNDERa/boSbGEWy6nB7tk//FkyEyN4EcYe0c0TJgyf5b+MVf8c7V2brHZq oZ3g9di1IwzFDKut/yMPm9mOe2UlU22RWOOUgXEfIY1/GLUfiw3+ROLN6lMxLBsx5+0F 11CGIZehyPVI4o4LD9J+2HWgjFvY4a6QXRwmpV1XIxcW9aEwIDUDottOadYRHvGb4Tui cU9g==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author