mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-04-16 03:02:47 +02:00
main/apk-tools: update zsh-completion
This commit is contained in:
parent
9cefc640d9
commit
a7f860dc9c
@ -1,7 +1,7 @@
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=apk-tools
|
||||
pkgver=2.12.0
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="Alpine Package Keeper - package manager for alpine"
|
||||
arch="all"
|
||||
url="https://gitlab.alpinelinux.org/alpine/apk-tools"
|
||||
@ -78,4 +78,4 @@ luaapk() {
|
||||
}
|
||||
|
||||
sha512sums="feabd7959e6212156191b8468a10193103ea8887f921060891c5fdb6e17258cb0d80140cbcd27affd572086dcc9244bce9328ae3c352659ca7db213bf79eae6a apk-tools-v2.12.0.tar.gz
|
||||
fa9502ad205d91694487c4731e241e970654a623262b41172ac5fbb86b6d0d1baeae105e024d2fc38eb56a3b5e0ff154f8ff36ca24fca6d65d4279cc1a20562f _apk"
|
||||
cedda9bf11e0a516c9bf0fd1a239ffa345cdd236419cbd8b10273410610ae7d0f0f61fd36e1e9ccc3bbf32f895508cdca4fb57a0e04f78dd88469b33bf64a32a _apk"
|
||||
|
||||
@ -50,27 +50,33 @@ function _apk {
|
||||
local curcontext="$curcontext"
|
||||
local ret=1
|
||||
|
||||
function _ccache_apk_world { [[ ~/.zshcompcache/apk_index_packages_installed -ot /etc/apk/world ]] }
|
||||
|
||||
# TODO: Add _ccache_apk_avail for available packages, some systems don't have a package cache
|
||||
# so there's a bit of work for that. apk is still pretty quick so this is not necessary
|
||||
function _ccache_apk_world { [[ "$1" -ot /etc/apk/world ]] }
|
||||
function _ccache_apk_avail {
|
||||
for i in /etc/apk/cache/APKINDEX.*; do
|
||||
[[ "$1" -ot "$i" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
function _apk_available_pkgs {
|
||||
local -a packs
|
||||
local -a _apk_available_packs
|
||||
zstyle ":completion:${curcontext}:" cache-policy _ccache_apk_avail
|
||||
local IFS=$'\n'
|
||||
packs=(${$(/sbin/apk list -a)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
|
||||
_describe 'available packages' packs
|
||||
if _cache_invalid apk_index_packages_available || ! _retrieve_cache apk_index_packages_available; then
|
||||
_apk_available_packs=(${$(/sbin/apk list -a 2>/dev/null)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
|
||||
_store_cache apk_index_packages_available _apk_available_packs
|
||||
fi
|
||||
_describe 'available packages' _apk_available_packs
|
||||
}
|
||||
|
||||
function _apk_installed_pkgs {
|
||||
local -a packs
|
||||
local -a _apk_installed_packs
|
||||
zstyle ":completion:${curcontext}:" cache-policy _ccache_apk_world
|
||||
local IFS=$'\n'
|
||||
if _cache_invalid apk_index_packages_installed || ! _retrieve_cache apk_index_packages_installed; then
|
||||
packs=(${$(/sbin/apk list -I)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
|
||||
_store_cache apk_index_packages_installed packs
|
||||
_apk_installed_packs=(${$(/sbin/apk list -I 2>/dev/null)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
|
||||
_store_cache apk_index_packages_installed _apk_installed_packs
|
||||
fi
|
||||
_describe 'installed packages' packs
|
||||
_describe 'installed packages' _apk_installed_packs
|
||||
}
|
||||
|
||||
function _apk_packages {
|
||||
@ -226,9 +232,7 @@ function _apk {
|
||||
"*:package:_apk_packages"
|
||||
)
|
||||
;;
|
||||
(policy)
|
||||
completion_spec+=("*:package:_apk_packages")
|
||||
;;
|
||||
(policy) completion_spec+=("*:package:_apk_packages");;
|
||||
esac
|
||||
|
||||
_arguments -C -s $completion_spec && ret=0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user