aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-04-30 00:06:07 +0200
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-04-30 00:08:12 +0200
commit1caaa6e001f9c2ba2557913e56d53a991041cf96 (patch)
treeec2e91ff9293bef986ad59acfb5dae5b480b0023
parentf466e01232bad12556f14d4a3fe7c52f8f46e7a8 (diff)
downloadpaludis-1caaa6e001f9c2ba2557913e56d53a991041cf96.tar.gz
paludis-1caaa6e001f9c2ba2557913e56d53a991041cf96.tar.xz
zsh-completion: Use completion cache. Patch by yzaikin. fixes:737
-rw-r--r--zsh-completion/_paludis_packages16
1 files changed, 11 insertions, 5 deletions
diff --git a/zsh-completion/_paludis_packages b/zsh-completion/_paludis_packages
index 2ed5941..f839b21 100644
--- a/zsh-completion/_paludis_packages
+++ b/zsh-completion/_paludis_packages
@@ -5,12 +5,15 @@
# Written by Baptiste Daroussin <baptux at free.fr>
# Usage: _paludis_packages installed|available|repositories|categories|sets|repository-formats
-local flags prepo packages categories paludis_pkgs
+local flags prepo packages categories
_paludis_packages_update_available() {
if [[ $PREFIX != -* ]]; then
if [[ $PREFIX != */* ]];then
- paludis_pkgs=(${(o)${${(M)${(f)"$(paludis --log-level silent --list-packages)"}:#\* *}##\* }##*/})
- _wanted paludis_pkgs expl "packages" compadd - ${(@)paludis_pkgs}
+ if ( [[ ${+_paludis_pkgs_available} -eq 0 ]] || _cache_invalid PALUDIS_available ) && ! _retrieve_cache PALUDIS_available ; then
+ _paludis_pkgs_available=(${(o)${${(M)${(f)"$(paludis --log-level silent --list-packages)"}:#\* *}##\* }##*/})
+ _store_cache PALUDIS_available _paludis_pkgs_available
+ fi
+ _wanted paludis_pkgs expl "packages" compadd - ${(@)_paludis_pkgs_avail}
categories=(${${(M)${(f)"$(paludis --log-level silent --list-categories)"}:#\* *}##\* })
_wanted cat_packages expl "category/packages" compadd -S "/" $categories
else
@@ -27,8 +30,11 @@ _paludis_packages_update_repository-formats() {
}
_paludis_packages_update_installed() {
- packages=(${${(M)${(f)"$(paludis --log-level silent --repository installed --list-packages)"}:#\* *}##\* })
- compadd ${(@)packages}
+ if ( [[ ${+_paludis_pkgs_installed} -eq 0 ]] || _cache_invalid PALUDIS_installed ) && ! _retrieve_cache PALUDIS_installed ; then
+ _paludis_pkgs_installed=(${${(M)${(f)"$(paludis --log-level silent --repository installed --list-packages)"}:#\* *}##\* })
+ _store_cache PALUDIS_installed _paludis_pkgs_installed
+ fi
+ compadd ${(@)_paludis_pkgs_inst}
}
_paludis_packages_update_categories() {
packages=(${${${(M)${(f)"$(paludis --log-level silent --list-categories)"}:#\* *}##\* }:#*(virtual|installed)*})