Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion: _opkg: Support gain-privileges
- X-seq: zsh-workers 43990
- From: dana <dana@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: [PATCH] Completion: _opkg: Support gain-privileges
- Date: Fri, 11 Jan 2019 17:34:17 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=kgLihJHRuWAf/0P7e/Nf7KFc0lgyiLma26wblU+BkWU=; b=lswOJDHAG9UToE2vFoBcXF2nXcCTT6AaVWGuGXj6M4DfGUhtk/pHHzxqGOnmQHyJnZ N3ZXJptJqqye6e1MWM4uZoqHz1N2NW2DbDkwAnecqvye5xFp6GCPJHcZlXDGMHtD5vib fykYPzY7bWVsK0zaujMv8YXsodWFikUfsDFTjC7MoIOTCN7suzUwl8z4Y7EekeFQroaw 2L+1fTa1+gm3VgNDVKA10H6kBft/XnYemmOm84AUdAOIsi/9rjWRV9cgESiIkI/SNW+L p2tP5tXMiKF1LQ97Vp9BKZt7Qq+GB1DrIS9nPVz+Esqdc+/x8BTLTjgRDfKr1O913qPl NOrw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This is apparently necessary even for 'read-only' tasks on systems where you
don't already have root (like Synology).
Also, it's a bit annoying if you have caching enabled and it caches an empty
array because you forgot to use sudo (or various other reasons depending on
the function). Maybe _store_cache should learn an option to make it ignore
empty parameters
dana
diff --git a/Completion/Linux/Command/_opkg b/Completion/Linux/Command/_opkg
index d64567681..ddaefe1eb 100644
--- a/Completion/Linux/Command/_opkg
+++ b/Completion/Linux/Command/_opkg
@@ -35,6 +35,10 @@
# % zstyle ':completion:*:opkg:*' conf-paths <pattern> ...
# Set to one or more paths or glob patterns to override the defaults used when
# searching opkg configuration data.
+#
+# Elevated privileges may be necessary to complete package names, etc.; consider
+# setting the gain-privileges style as follows:
+# zstyle ':completion:*:(ipkg|opkg)/*' gain-privileges yes
##
# Check cache validity.
@@ -105,7 +109,7 @@ _opkg_arch_prio() {
}
# Already configured arches
- tmp=( ${(f)"$( _call_program architectures $svc print-architecture )"} )
+ tmp=( ${(f)"$( _call_program -p architectures $svc print-architecture )"} )
tmp=( ${${tmp##arch[ ]##}%% *} )
tmp+=(
@@ -182,7 +186,9 @@ _opkg_pkg_all() {
{ (( ! $#_opkg_cache_pkg_all )) || _cache_invalid opkg-pkg-all } &&
! _retrieve_cache opkg-pkg-all && {
- _opkg_cache_pkg_all=( ${(f)"$( _call_program pkg-all ${svc:-opkg} list )"} )
+ _opkg_cache_pkg_all=( ${(f)"$(
+ _call_program -p pkg-all ${svc:-opkg} list )"}
+ )
_opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all##[[:space:]]*} )
_opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all%%[[:space:]]*} )
_store_cache opkg-pkg-all _opkg_cache_pkg_all
@@ -207,7 +213,7 @@ _opkg_pkg_inst() {
{ (( ! $#_opkg_cache_pkg_inst )) || _cache_invalid opkg-pkg-inst } &&
! _retrieve_cache opkg-pkg-inst && {
_opkg_cache_pkg_inst=( ${(f)"$(
- _call_program pkg-inst ${svc:-opkg} list-installed
+ _call_program -p pkg-inst ${svc:-opkg} list-installed
)"} )
_opkg_cache_pkg_inst=( ${(@)_opkg_cache_pkg_inst##[[:space:]]*} )
_opkg_cache_pkg_inst=( ${(@)_opkg_cache_pkg_inst%%[[:space:]]*} )
@@ -257,7 +263,7 @@ _opkg_pkg_upgr() {
{ (( ! $#_opkg_cache_pkg_upgr )) || _cache_invalid opkg-pkg-upgr } &&
! _retrieve_cache opkg-pkg-upgr && {
_opkg_cache_pkg_upgr=( ${(f)"$(
- _call_program pkg-upgr ${svc:-opkg} list-upgradable
+ _call_program -p pkg-upgr ${svc:-opkg} list-upgradable
)"} )
_opkg_cache_pkg_upgr=( ${(@)_opkg_cache_pkg_upgr##[[:space:]]*} )
_opkg_cache_pkg_upgr=( ${(@)_opkg_cache_pkg_upgr%%[[:space:]]*} )
Messages sorted by:
Reverse Date,
Date,
Thread,
Author