From d4f989973952063a4815898eebb0c3922513aad5 Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 22 Feb 2019 13:20:16 -0600 Subject: 44077: completion: Fix GNU _pick_variant patterns, partially fix `getent -s` --- ChangeLog | 6 ++++++ Completion/Unix/Command/_getent | 14 +++++++++----- Completion/Unix/Command/_iconv | 2 +- Completion/Unix/Command/_ldd | 2 +- Completion/Unix/Command/_locale | 2 +- Completion/Unix/Command/_localedef | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9fc99232..0769987d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2019-02-22 dana + * 44077: Completion/Unix/Command/_getent, + Completion/Unix/Command/_iconv, Completion/Unix/Command/_ldd, + Completion/Unix/Command/_locale, + Completion/Unix/Command/_localedef: Fix outdated _pick_variant + patterns, partially fix `getent -s` + * 44076 (tweaked): Completion/Unix/Command/_column: Support Debian column, add missing util-linux options, adjust wording 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 \ -- cgit 1.4.1