aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2016-03-09 02:36:50 -0500
committerTim Harder <radhermit@gmail.com>2016-03-09 02:49:49 -0500
commit990209a2dcbfb3d034d99ef1a62eba8de5d3f16c (patch)
tree6a738cae48daba2da2286025c906d503d87e42d1
parentportage_conf: make repos immutable initially (diff)
downloadpkgcore-binpkg.tar.gz
pkgcore-binpkg.tar.bz2
pkgcore-binpkg.zip
shell/zsh: add initial binpkg support for completionbinpkg
-rw-r--r--shell/zsh/pkgcore.zsh37
1 files changed, 36 insertions, 1 deletions
diff --git a/shell/zsh/pkgcore.zsh b/shell/zsh/pkgcore.zsh
index 256969d3..d456bd87 100644
--- a/shell/zsh/pkgcore.zsh
+++ b/shell/zsh/pkgcore.zsh
@@ -76,7 +76,7 @@ _array_index() {
# configured repo info
#
# Note that this only supports the repos.conf format,
-# PORTDIR/PORTDIR_OVERLAY in make.conf are not supported.
+# PORTDIR and PORTDIR_OVERLAY are not supported.
#
# optional args:
# -t repo_types -- show specific repo types (defaults to showing source repos)
@@ -332,3 +332,38 @@ _profiles() {
print ${profiles}
fi
}
+
+# available binpkgs
+#
+# Note that this only supports the repos.conf format,
+# PKGDIR and PORTAGE_BINHOST are not considered.
+#
+# optional args
+# -r repo specify the repo to use; otherwise the all repos are used
+# -p print the output instead of using completion
+# -f output full, absolute profile paths
+_binpkgs() {
+ typeset -A opts
+ zparseopts -E -A opts a p f r:
+
+ local repo repo_path
+ typeset -a repos binpkgs
+
+ if [[ -n ${opts[(I)-r]} ]]; then
+ repos=(${opts[-r]})
+ else
+ repos=($(_repos -p -t b))
+ fi
+
+ for repo in "${repos[@]}"; do
+ repo_path=${$(_repos -p -v "${repo}:location")%/}
+ [[ -z ${repo_path} ]] && continue
+ binpkgs+=(_path_files -g \*.tbz2 -W "${repo_path}/*")
+ done
+
+ if [[ -n ${compstate} ]] && [[ -z ${opts[(I)-p]} ]]; then
+ _describe -t binpkgs 'binpkgs' binpkgs
+ else
+ print ${binpkgs}
+ fi
+}