Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion: Fix _pick_variant checks for GNU, improve _getent
- X-seq: zsh-workers 44077
- From: dana <dana@xxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: [PATCH] Completion: Fix _pick_variant checks for GNU, improve _getent
- Date: Thu, 21 Feb 2019 22:03:03 -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=A+pnrJ6UkoKIJWRAcKV5cu+1rNLH5vUQJeKRd01AUV8=; b=iJOk5jr+XqekehXbwk3MXSyE9atGZvN0j0yghBAc7UUaL/sB8m6ZS8pO2+bIxCDrd/ BmxQi8g0PtLDq7T0Z3a4a7wRZdKQQYV54vZYkNpn7+CksTWsiCB/zLfqEhgkECXMrD7f CafCKEj2vQZ3Oqn6MWLKy7GQMG7WKTGWUQoUqGD7LOBHywZYaDjaXsFosEDHRQkpAUzh p/VmEVOzBk+sFSRxJt8BEj9Q3GuLBtPRtwBy9LL/ehJN7PeFxuITOZ9Jzo8rSc92JsQ9 8IgfY3ngkTthGJPuLVwBRs0lztBoDZYqETR4qo9Dhr4+jEY0v+5FiNUhtoc+dWzU+GjC wttQ==
- 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
I noticed that GNU getent isn't detected correctly due to an out-of-date
_pick_variant pattern. I've fixed that and a few others by changing EGLIBC to
just GLIBC. I've also added 'Free Soft' where it wasn't present, just in case
Since i was there, i partially fixed `getent -s` completion as well
dana
diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent
index 7f4e8bc9c..0fb9a0af4 100644
--- a/Completion/Unix/Command/_getent
+++ b/Completion/Unix/Command/_getent
@@ -5,24 +5,28 @@ local services databases keys
local -a args
typeset -A opt_args
-if _pick_variant -r is_gnu gnu='(GNU|EGLIBC|Gentoo)' unix --version; then
+if _pick_variant -r is_gnu gnu='(Free Soft|GNU|GLIBC|Gentoo)' unix --version; then
args+=(
'(- 1 *)'{-\?,--help}'[display help information]'
'(- 1 *)--usage[display a short usage message]'
'(- 1 *)'{-V,--version}'[display version information]'
- {-s,--service=}'[specify service configuration to use]:service:->services'
+ '*'{-s+,--service=}'[specify service configuration to use]: :->services'
'(-i --no-idn)'{-i,--no-idn}'[disable IDN encoding]'
)
fi
-_arguments -C "$args[@]" \
+_arguments -s -S -C "$args[@]" \
'1:database:->databases' \
'*:key:->keys' && ret=0
case $state in
services)
- services=( /lib/libnss*(-.:fr:t:s/libnss_//) )
- _wanted services expl service compadd ${services%-*} && ret=0
+ # @todo GNU getent supports both `-s svc` and `-s db:svc`; we only complete
+ # the former here
+ services=( {,/usr}/lib/{,*-linux-gnu/}libnss_*(N-.:fr:t:s/libnss_//) )
+ _wanted services expl 'service or database:service' \
+ compadd ${(u)services%-*} \
+ && ret=0
;;
databases)
if [[ $is_gnu = gnu ]]; then
diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv
index d040be756..e6daad938 100644
--- a/Completion/Unix/Command/_iconv
+++ b/Completion/Unix/Command/_iconv
@@ -2,7 +2,7 @@
local expl curcontext="$curcontext" state line variant ret=1
-if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix --version; then
+if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(Free Soft|GNU*libc|GLIBC|Gentoo)' unix --version; then
local -a args
local exargs="-l --list -? --help --usage --version -V"
diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd
index 1de1659a5..3c7b088df 100644
--- a/Completion/Unix/Command/_ldd
+++ b/Completion/Unix/Command/_ldd
@@ -1,6 +1,6 @@
#compdef ldd
-if _pick_variant gnu='(Free Soft|GNU|EGLIBC|Gentoo)' unix --version; then
+if _pick_variant gnu='(Free Soft|GNU|GLIBC|Gentoo)' unix --version; then
args=(
'(- *)--version[display version information]'
'(- *)--help[display help information]'
diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale
index 59e04a282..a7fd88f65 100644
--- a/Completion/Unix/Command/_locale
+++ b/Completion/Unix/Command/_locale
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state state_descr line expl ret=1
typeset -A opt_args; local -a specs aopts
-if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then
+if _pick_variant gnu='(Free Soft|GNU|GLIBC)' unix --version; then
local exargs="-? --help --usage -V --version"
diff --git a/Completion/Unix/Command/_localedef b/Completion/Unix/Command/_localedef
index 4d4b4bbe3..57637e3ec 100644
--- a/Completion/Unix/Command/_localedef
+++ b/Completion/Unix/Command/_localedef
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
-if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then
+if _pick_variant gnu='(Free Soft|GNU|GLIBC)' unix --version; then
local exargs="-? --help --usage -V --version"
_arguments -A "-*" -C -S -s \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author