about summary refs log tree commit diff
path: root/Completion/Unix/Command/_getent
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_getent')
-rw-r--r--Completion/Unix/Command/_getent14
1 files changed, 9 insertions, 5 deletions
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