diff options
| author | Aljaž "g5pw" Srebrnič <a2piratesoft@gmail.com> | 2013-03-24 22:31:08 +0100 |
|---|---|---|
| committer | Aljaž "g5pw" Srebrnič <a2piratesoft@gmail.com> | 2013-03-24 22:31:08 +0100 |
| commit | f2cff3dbf37504945a586f364112a41dfb7060c3 (patch) | |
| tree | 44ff3d5bf549c625cb66bdf9ae8a8ef2d01574f7 /src/_port | |
| parent | Use native caching system (diff) | |
| download | zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar.gz zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar.bz2 zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar.lz zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar.xz zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.tar.zst zsh-completions-f2cff3dbf37504945a586f364112a41dfb7060c3.zip | |
Use own cache policy
This checks modification dates of the repository database and completion cache
and refreshes the latter if it is older than the database.
Diffstat (limited to 'src/_port')
| -rw-r--r-- | src/_port | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -70,6 +70,12 @@ _port() { '*:extra:->extra' \ && return 0 + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy + fi + case "$state" in extra) case "$words[2]" in @@ -133,4 +139,11 @@ _port_select() { fi } +_port_caching_policy() { + local reg_time comp_time + reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db) + comp_time=$(stat -c '%Z' $1) + return $(( reg_time < comp_time )) +} + _port "$@" |
