about summary refs log tree commit diff
path: root/Completion/User/_groups
blob: bc955a8d27599ca3f7dec40d61cf126b683e2f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#compdef newgrp

local expl

_tags any groups || return 1

if (( ! $+groups )); then
  if whence -p ypcat > /dev/null; then
    : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use NIS
  else
    : ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}}
  fi
fi

_description expl group
compadd "$@" "$expl[@]" - $groups