mirror of
https://github.com/zsh-users/zsh-completions.git
synced 2026-09-17 16:00:19 +00:00
A better cache policy for _port
This compares modification times of the main PortIndex for all ports and registry.db for installed ports.
This commit is contained in:
@@ -225,8 +225,16 @@ _port_select() {
|
||||
}
|
||||
|
||||
_port_caching_policy() {
|
||||
local reg_time comp_time
|
||||
reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db)
|
||||
local reg_time comp_time check_file
|
||||
case "${1##*/}" in
|
||||
PORT_INSTALLED_PACKAGES)
|
||||
check_file=$port_prefix/var/macports/registry/registry.db
|
||||
;;
|
||||
PORT_AVAILABLE_PACKAGES)
|
||||
check_file=${$(port dir MacPorts)%/*/*}/PortIndex
|
||||
;;
|
||||
esac
|
||||
reg_time=$(stat -c '%Z' $check_file)
|
||||
comp_time=$(stat -c '%Z' $1)
|
||||
return $(( reg_time < comp_time ))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user