From 580698bc7136454941dd6bbc2ca70f240fabc6b7 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 19 Aug 2016 18:00:07 +0200 Subject: 39067: update options to correspond to latest versions of software in various functions --- Completion/Unix/Command/_user_admin | 206 +++++++++++++++++++++++++++--------- 1 file changed, 154 insertions(+), 52 deletions(-) (limited to 'Completion/Unix/Command/_user_admin') diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index 3653308a1..f0777729c 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -1,69 +1,171 @@ #compdef useradd usermod groupadd groupmod -local args shells home=${${words[(r)-D]:+b}:-d} sun redhat +local -a args shells logindefs +local defex -[[ -e /etc/redhat-release || -e /etc/mandrake-release ]] -redhat=$? - -if [[ $service = user* ]]; then - if [[ -r /etc/shells ]]; then - shells=( ${${(f)"$()) + args+=( + '(-b --base-dir -d --home-dir)'{-b,--base-dir=}'[specify base directory for new home directory]:directory:_directories' + ) + ;| + user:*:(net|open)bsd*) + args+=( + '-L[specify login class]:login class' + '-p+[specify encrypted password]:encrypted password' + ) + ;| + user:add:(net|open)bsd*) + args+=( '-r[specify UID range]:low.high' ) + ;| + user:add:netbsd*) + args+=( '-M[specify home directory permissions]:permissions (octal)' ) + ;| + user:mod:netbsd*) + args+=( '-C[lock or unlock account]:locked:(yes no)' ) + ;| + user:*:netbsd*) + args+=( + '-F[force password change on first login]' + '-S[allow samba usernames with a trailing dollar]' + ) + ;| + user:mod:openbsd*) + args+=( + '(-G)-S+[set supplementary groups]:supplementary group:_sequence _groups' + "(-U)-Z[lock the account by adding \'-\' to password and shell]" + '(-Z)-U[unlock the account]' + ) + ;| + *:*:(net|open)bsd*) + args+=( '-v[verbose mode - explain commands as they are executed]' ) + ;| + *:*:solaris2.<11->) + args+=( '-S[specify repository]:repository:(files ldap)' ) + ;| + user:*:solaris2.<11->) + args+=( + '-A[specify authorizations]:authorization' + \*{-K,--key=}'[set user attributes]:user attribute' + '-P[specify execution profiles]:profile' + '-R[specify roles]:role' + '-p[specify projects]:project' ) - [[ $OSTYPE = openbsd* ]] || args+=('-a[append groups]') + ;| + user:mod:solaris2.<11->) args+=( - '-l[specify new user name]:new username' + '-q[specify host or netgroup to qualify extended attributes]:host or netgroup:_hosts' + ) + ;| + user:mod:linux*) + args+=( + '(-a --append)'{-a,--append}'[add user to supplementary groups without removing from other groups]' + \*{-v,--add-sub-uids}'[add a range of subordinate uids]:uids (first-last)' + \*{-V,--del-sub-uids}'[remove a range of subordinate uids]:uids (first-last)' + \*{-w,--add-sub-gids}'[add a range of subordinate gids]:gids (first-last)' + \*{-W,--del-sub-gids}'[remove a range of subordinate gids]:gids (first-last)' + ) + ;| + user:mod:*) + args+=( + '(-l --no-log-init)'{-l,--no-log-init}'[specify new user name]:new username' + '(-m --move-home)'{-m,--move-home}'[move home directory contents to new location]' ':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]' + ;| + user:*:linux*) + args+=( + '(-U --unlock --lock -L -p)'{-L,--lock}"[lock user's password]" + '(-U --unlock --lock -L -p)'{-U,--unlock}"[unlock user's password]" + '(-Z --selinux-user)'{-Z,--selinux-user}"[specify SELinux user for the user's login]:user" + ) + ;| + group:*) + args+=( + '(-g,--gid)'{-g+,--gid=}'[specify gid]:gid' + '(-o --non-unique)'{-o,--non-unique}'[allow non unique gid]' ) - else + ;| + group:add:linux*) + logindefs=( GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP SYS_GID_MAX SYS_GID_MIN ) + args+=( + '(-r --system)'{-r,--system}'[create a system account]' + '(-f --force)'{-f,--force}'[exit successfully if group already exists; cancel -g if GID in use]' + ) + ;| + group:*:solaris2.<11->) + args+=( '-U[add users to the group]:user:_sequence _users' ) + ;| + *:add:linux*) + args+=( + \*{-K,--key=}'[override /etc/login.defs defaults]:key: _values 'key' ${^logindefs}\:value' + ) + ;| + group:add:netbsd*) + args+=( '-r[specify GID range]:low.high' ) + ;| + *:*:linux*) + args+=( + '(-R --root)'{-R,--root=}'[specify directory to chroot into]:directory:_directories' + '(-D -U -L -p --password)'{-p+,--password=}'[specify encrypted password]:encrypted password' + '(-)'{-h,--help}'[display help information]' + ) + ;| + group:add:*) + args+=( ':group name' ) + ;| + group:mod:*) args+=( - '-n[specify new group name]:new group name' + '(-n --new-name)'{-n,--new-name}'[specify new group name]:new group name' ':group:_groups' ) - fi -fi + ;| + ^*:linux*) + args=( ${(R)args:#(|\*)(|\(*\))--*} ) # remove long options + ;| +esac _arguments -A "-*" -s $args[@] -- cgit 1.4.1