Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: new and updated completions



Chmouel Boudjnah wrote:
> 
> > anyone can think of a good way to detect RedHat/Mandrake, please let me
> 
> /etc/{mandrake,redhat}-release

Perfect. Thanks.

Oliver

Index: Completion/Unix/Command/_user_admin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_user_admin,v
retrieving revision 1.1
diff -u -r1.1 _user_admin
--- Completion/Unix/Command/_user_admin 2001/08/06 14:42:04     1.1
+++ Completion/Unix/Command/_user_admin 2001/08/08 11:32:58
@@ -1,6 +1,6 @@
 #compdef useradd usermod groupadd groupmod
 
-local args shells home=${${words[(r)-D]:+b}:-d} sun=" -s"
+local args shells home=${${words[(r)-D]:+b}:-d} sun
 
 if [[ $service = user* ]]; then
   if [[ -r /etc/shells ]]; then
@@ -17,31 +17,29 @@
     '(-D)-g+[initial group]:initial group:_groups'
     '(-D)-G+[supplementary groups]:supplementary groups:_groups -S,'
     "(-D)-s+[shell]:shell:( $shells /dev/null )"
-    '(-D)-m[create home directory]'
+    '(-D -M)-m[create home directory]'
     '(-D)-u[uid]:uid'
     '(-D)-o[allow non unique uid]'
   )
   [[ $OSTYPE = linux* ]] && args=( $args[@] 
-      '(-D)-p+[specify encrypted password]:encrypted password' )
+      '(-D -U -L)-p+[specify encrypted password]:encrypted password' )
 
   if [[ $service = useradd ]]; then
-    if [[ $OSTYPE = linux* ]]; then
-      args=( $args[@]
-       "(-D -k)-M[don't create home]"
-       '(-D)-r[create system account]'
-       "(-D)-n[don't create mirrored user]"
-      )
-      unset sun
-    fi
+    [[ -e /etc/redhat-release ]] && args=( $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=( $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
-    [[ $OSTYPE = linux* ]] && args=( $args[@]
-       "(-U)-L[lock user's password]"
-       "(-L)-U[unlock user's password]"
+    [[ -e /etc/redhat-release ]] && args=( $args[@]
+       "(-U -p)-L[lock user's password]"
+       "(-L -p)-U[unlock user's password]"
     )
     args=( $args[@]
       '-l[specify new user name]:new username'
@@ -52,7 +50,7 @@
   args=( '-g+[gid]:gid' '-o[allow non unique gid]' )
   if [[ $service = groupadd ]]; then
     args=( $args[@] ':group name' )
-    [[ $OSTYPE = linux* ]] && args=( $args[@]
+    [[ -e /etc/redhat-release ]] && args=( $args[@]
       '-r[create system group]'
       '-f[force]'
     )



Messages sorted by: Reverse Date, Date, Thread, Author