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

local expl

_wanted groups expl group || return 1

if (( ! $+groups )); then
  if (( ${+commands[ypcat]} )); then
    : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use YP
  else
    : ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}}
  fi
fi

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