1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

44077: completion: Fix GNU _pick_variant patterns, partially fix getent -s

This commit is contained in:
dana 2019-02-22 13:20:16 -06:00
parent 7930905f0c
commit d4f9899739
6 changed files with 19 additions and 9 deletions

View file

@ -1,5 +1,11 @@
2019-02-22 dana <dana@dana.is>
* 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

View file

@ -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

View file

@ -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"

View file

@ -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]'

View file

@ -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"

View file

@ -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 \