From 759f8fa7622389e5c0fe2dfbfbaeff83e90322a0 Mon Sep 17 00:00:00 2001
From: Maxim Karasev <begs@disroot.org>
Date: Wed, 5 Jan 2022 20:58:09 +0300
Subject: [PATCH] main/apk-tools: update zsh completion

This adds completion for 'apk search', fixes a typo and adds some missing
parameters to other subcommands.
---
 main/apk-tools/APKBUILD |  4 ++--
 main/apk-tools/_apk     | 44 +++++++++++++++++++++++++++++++++--------
 2 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 92ff452297e3..26744eea6b7e 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
 pkgname=apk-tools
 pkgver=2.12.9
-pkgrel=0
+pkgrel=1
 pkgdesc="Alpine Package Keeper - package manager for alpine"
 arch="all"
 url="https://gitlab.alpinelinux.org/alpine/apk-tools"
@@ -87,5 +87,5 @@ luaapk() {
 
 sha512sums="
 2e299e50c5ca8733f04fad971247146ff4bebb697c3589e4692c9a940ede89432dd9fea48004dc947cb493db1206a336ac0ad1e876b02683183d69b4a127d1c6  apk-tools-v2.12.9.tar.gz
-102e6d01a984fb7a84c9432f797e4d8d2c90e9570dd26208b8485569ab471ea88a2cc81eabd3b3f7e4c9685a37afc458dec172a65b03c19c78a7efb598c54f45  _apk
+48d5437bb8e76b56f972430ac95f1f408687dd2734ff3e69192140abe8f301154329d9cbef0c17da86ac8d825f32bc818376bdfb672bf44adbfa5e21c957d5ec  _apk
 "
diff --git a/main/apk-tools/_apk b/main/apk-tools/_apk
index d00105c01276..0ce54d74ded1 100644
--- a/main/apk-tools/_apk
+++ b/main/apk-tools/_apk
@@ -12,7 +12,7 @@ function _apk {
 		"(-V --version)"{-V,--version}"[Print program version and exit]"
 		"(-X --repository)"{-X,--repository}"[Specify additional package repository]:repository:_host"
 		"--allow-untrusted[Install packages with untrusted signature or no signature]"
-		"--arch[Temporarily override architecture]:arch:(armhf mips64 s390x x86_64 x86 aarch64 ppc64le armv7)"
+		"--arch[Temporarily override architecture]:arch:(armhf mips64 s390x x86_64 x86 aarch64 ppc64le armv7 riscv64)"
 		"--cache-dir[Temporarily override the cache directory]:directory:_dir_list"
 		"--cache-max-age[Maximum age for index in cache before it's refreshed]:minutes"
 		"--force-binary-stdout[Continue even if binary data will be printed to the terminal]"
@@ -104,6 +104,7 @@ function _apk {
 			"list:List packages matching a pattern or other criteria"
 			"dot:Render dependencies as graphviz graphs"
 			"policy:Show repository policy for packages"
+			"search:Search for packages by name or description"
 			"index:Create repository index file from packages"
 			"fetch:Download packages from global repositories to a local directory"
 			"manifest:Show checksums of package contents"
@@ -125,13 +126,14 @@ function _apk {
 			$upgrade_opt \
 			"--initdb[Initialize a new package database]" \
 			"(-t --virtual)"{-t,--virtual}"[Create virtual package with given dependencies]" \
+			"--no-chown[Do not change file owner or group]" \
 			"*:package:_apk_packages"
 		)
 	;;
 	(del)
 		completion_spec+=(
 			$commit_opts \
-			"--rdepeds[Recursively delete all top-level reverse dependencies]" \
+			"(-r --rdepends)"{-r,--rdepends}"[Recursively delete all top-level reverse dependencies]" \
 			"*:installed package:_apk_installed_pkgs"
 		)
 	;;
@@ -172,15 +174,16 @@ function _apk {
 			"(-d --description)"{-d,--descripton}"[Print the package description]" \
 			"(-e --installed)"{-e,--installed}"[Check package installed status]" \
 			"(-L --contents)"{-L,--contents}"[List files included in the package]" \
-			"(-i --install-if)"{-i,--install-if}"[List the package's install_if rule]" \
-			"(-I --rinstall-if)"{-I,--rinstall-if}"[List other packages whose install_if rules refer to this package]" \
+			"(-P --provides)"{-P,--provides}"[List what the package provides]" \
 			"(-r --rdepends)"{-r,--rdepends}"[List reverse dependencies of the package]" \
 			"(-R --depends)"{-R,--depends}"[List the dependencies of the package]" \
 			"(-s --size)"{-s,--size}"[Print the package's installed size]" \
 			"(-w --webpage)"{-w,--webpage}"[Print the URL for the package's upstream webpage]" \
 			"(-W --who-owns)"{-W,--who-owns}"[Print the package which owns the specified file]:file:_files" \
+			"(-i --install-if)"{-i,--install-if}"[List the package's install_if rule]" \
 			"--license[Print the package SPDX license identifier]" \
 			"--replaces[List the other packages for which this package is marked as a replacement]" \
+			"(-I --rinstall-if)"{-I,--rinstall-if}"[List other packages whose install_if rules refer to this package]" \
 			"--triggers[Print active triggers for the package]" \
 			"*:package:_apk_packages"
 		)
@@ -190,7 +193,7 @@ function _apk {
 			"(-I --installed)"{-I,--installed}"[Consider only installed packages]" \
 			"(-O --orphaned)"{-O,--orphaned}"[Consider only orphaned packages]" \
 			"(-a --available)"{-a,--available}"[Consider only available packages]" \
-			"(-u --upgradeable)"{-u,--upgradeable}"[Consider only upgradable packages]" \
+			"(-u --upgradable --upgradeable)"{-u,--upgradable,--upgradeable}"[Consider only upgradable packages]" \
 			"(-o --origin)"{-o,--origin}"[List packages by origin]" \
 			"(-d --depends)"{-d,--depends}"[List packages by dependency]" \
 			"(-P --providers)"{-P,--providers}"[List packages by provider]" \
@@ -209,6 +212,7 @@ function _apk {
 			"(-o --output)"{-o,--output}"[Output generated index to file]:output:_files" \
 			"(-x --index)"{-x,--index}"[Read an existing index to speed up the creation of the new index]" \
 			"--no-warnings[Disable warnings about missing dependencies]" \
+			"--rewrite-arch[Set all package's architecture to arch]:arch:(armhf mips64 s390x x86_64 x86 aarch64 ppc64le armv7 riscv64)" \
 			"*:package:_apk_packages"
 		)
 	;;
@@ -219,20 +223,44 @@ function _apk {
 			"(-r --recursive)"{-r,--recursive}"[Fetch packages and all of their dependencies]" \
 			"(-s --stdout)"{-s,--stdout}"[Dump the .apk file(s) to stdout]" \
 			"--simulate[Simulate the requested operation without making any changes]" \
+			"--url[Print the full URL for downloaded packages]" \
 			"*:package:_apk_packages"
 		)
 	;;
 	(manifest) completion_spec+=("*:package:_apk_packages");;
 	(verify) completion_spec+=("*:package:_apk_packages");;
-	(audit) completion_spec+=("*:files:_files");;
+	(audit)
+		completion_spec+=(
+			"--backup[Audit configuration files only (default)]" \
+			"--check-permissions[Check file permissions too]" \
+			"--packages[Print only the packages with changed files]" \
+			"--system[Audit all system files]" \
+			"(-r --recursive)"{-r,--recursive}"[Descent into directories and audit them as well]" \
+			"*:files:_files"
+		)
+	;;
 	(version)
 		completion_spec+=(
-			"-a[Consider packages from all repository tags]" \
-			"-l[Limit to packages with output matching given operand]:operand" \
+			"(-a --all)"{-a,--all}"[Consider packages from all repository tags]" \
+			"(-c --check)"{-c,--check}"[Check versions for validity]:*: " \
+			"(-I --indexes)"{-I,--indexes}"[Print the version and description for each repository's index]:*: " \
+			"(-l --limit)"{-l,--limit}"[Limit to packages with output matching given operand]:operand:('>' '=' '<' '>=' '<=')" \
+			"(-t --test)"{-t,--test}"[Compare two version strings]:*: " \
 			"*:package:_apk_packages"
 		)
 	;;
 	(policy) completion_spec+=("*:package:_apk_packages");;
+	(search)
+		completion_spec+=(
+			"(-a --all)"{-a,--all}"[Print all matching package versions]" \
+			"(-d --description)"{-d,--description}"[Search in description as well]" \
+			"(-e -x --exact)"{-e,-x,--exact}"[Match package names exactly]" \
+			"--has-origin[Match by package origin]" \
+			"(-o --origin)"{-o,--origin}"[Print base package name]" \
+			"(-r --rdepends)"{-r,--rdepends}"[Print reverse dependencies]" \
+			"*:package:_apk_packages"
+		)
+	;;
 	esac
 
 	_arguments -C -s $completion_spec && ret=0
-- 
GitLab