CHips L MINI SHELL

CHips L pro

Current Path : /usr/share/zsh/4.3.11/functions/
Upload File :
Current File : //usr/share/zsh/4.3.11/functions/_user_admin

#compdef useradd usermod groupadd groupmod

local args shells home=${${words[(r)-D]:+b}:-d} sun redhat

[[ -e /etc/redhat-release || -e /etc/mandrake-release ]]
redhat=$?

if [[ $service = user* ]]; then
  if [[ -r /etc/shells ]]; then
    shells=( ${${(f)"$(</etc/shells)"}:#\#*} )
  else
    shells=( ${(M)commands:#*/(|[abckz]|tc|ba)sh} )
  fi

  args=(
    '(-D)-c+[comment]:comment'
    "(-D)-${home}+[home directory]:home directory:_directories -W /"
    '(-D)-e+[specify expiration date]:expiration date (YYYY-MM-DD)'
    '(-D)-f+[specify inactive days]:inactive days'
    '(-D)-g+[initial group]:initial group:_groups'
    '(-D)-G+[supplementary groups]:supplementary group:_groups -S,'
    "(-D)-s+[shell]:shell:( $shells /bin/false )"
    '(-D -M)-m[create home directory]'
    '(-D)-u[uid]:uid'
    '(-D)-o[allow non unique uid]'
  )
  [[ $OSTYPE = linux* ]] && args+=(
      '(-D -U -L)-p+[specify encrypted password]:encrypted password' )

  if [[ $service = useradd ]]; then
    (( redhat )) || args+=(
      "(-D -k -m)-M[don't create home]"
      '(-D)-r[create system account]'
      "(-D)-n[don't create mirrored user]"
    )
    [[ $OSTYPE = linux* ]] || sun=" -s"
    args+=(
      "(-c -G -m -k -M -p -u -o -n -r$sun)-D[modify or display defaults]"
      '(-D -M)-k[skeleton home directory]:skeleton directory:_directories -W /'
      ':username'
    )
  else
    (( redhat )) || args=( $args[@]
	"(-U -p)-L[lock user's password]"
	"(-L -p)-U[unlock user's password]"
    )
    args+=(
      '-l[specify new user name]:new username'
      ':username:_users'
    )
  fi
else
  args=( '-g+[gid]:gid' '-o[allow non unique gid]' )
  if [[ $service = groupadd ]]; then
    args+=( ':group name' )
    (( redhat )) || args=( $args[@]
      '-r[create system group]'
      '-f[force]'
    )
  else
    args+=(
      '-n[specify new group name]:new group name'
      ':group:_groups'
    )
  fi
fi

_arguments -A "-*" -s $args[@]

Copyright 2K16 - 2K18 Indonesian Hacker Rulez