<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -11,28 +11,19 @@
 # @license 'GPL'
 # @hide
 
-import sys
 import os
 import pygtk
 pygtk.require('2.0')
 import gtk
 import commands
-import getopt
+from optparse import OptionParser 
+parser = OptionParser()
+   
+parser.add_option(&quot;-m&quot;, &quot;--message&quot;, &quot;--msg&quot;, dest=&quot;message&quot;, default=None, help=&quot;Message to show&quot;, metavar=&quot;MESSAGE&quot;)
+parser.add_option(&quot;-c&quot;, &quot;--command&quot;, &quot;--cmd&quot;, dest=&quot;command&quot;, default=None, help=&quot;Command to run&quot;, metavar=&quot;COMMAND&quot;)
+            
+(options, args) = parser.parse_args()
 
-message=None
-command=None
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:], '', ['message=', 'command='])
-    for o, a in opts:
-      if o == '--message':
-        message = a
-      elif o == '--command':
-        command = a
-
-      
-except getopt.GetoptError:
-    pass
 
 def sel_users():
     USERS_LIST=commands.getoutput('cat /etc/passwd | grep bash | cut -d &quot;:&quot; -f 1').split('\n')
@@ -45,7 +36,7 @@ def sel_users():
         (None, gtk.DIALOG_MODAL,  \
         gtk.MESSAGE_QUESTION, \
         gtk.BUTTONS_OK)
-    dlg.set_markup ('&lt;b&gt;&#35531;&#36984;&#25799;&#27442; %s &#30340;&#20351;&#29992;&#32773;&#32048;&#38917;&#65306;&lt;/b&gt;' % message )
+    dlg.set_markup ('&lt;b&gt;&#35531;&#36984;&#25799;&#27442; %s &#30340;&#20351;&#29992;&#32773;&#32048;&#38917;&#65306;&lt;/b&gt;' % options.message )
     for user_name in USERS_LIST:
      user_name_box= user_name + &quot;_box&quot;
      dlg_bts[user_name_box]=gtk.CheckButton(user_name)
@@ -57,9 +48,9 @@ def sel_users():
     for user_name in USERS_LIST:
      user_name_box= user_name + &quot;_box&quot;
      if dlg_bts[user_name_box].get_active():
-      if command :
-       print &quot;&#27491;&#22312;&#28858;&quot; + user_name + message + &quot;...&quot; 
-       os.system(&quot;su -c &quot; + user_name + &quot; &quot; + command)
+      if options.command :
+       print &quot;&#27491;&#22312;&#28858;&quot; + user_name + options.message + &quot;...&quot; 
+       os.system(&quot;su -c &quot; + user_name + &quot; &quot; + options.command)
       else:
        print user_name ,
 
@@ -73,7 +64,7 @@ def user_scope ():
         (None, gtk.DIALOG_MODAL,  \
         gtk.MESSAGE_QUESTION, \
         gtk.BUTTONS_OK)
-    dlg.set_markup ('&lt;b&gt;&#35531;&#36984;&#25799;&#24744;&#27442; %s &#30340;&#20351;&#29992;&#32773;&#65306;&lt;/b&gt;' % message)
+    dlg.set_markup ('&lt;b&gt;&#35531;&#36984;&#25799;&#24744;&#27442; %s &#30340;&#20351;&#29992;&#32773;&#65306;&lt;/b&gt;' % options.message)
 
     currectuser_btn=gtk.RadioButton (None, '&#21482;&#22871;&#29992;&#21040;&#25105;&#33258;&#24049;')
     dlg.vbox.pack_start (currectuser_btn, False, True, 2)
@@ -97,16 +88,16 @@ def user_scope ():
 
     if currectuser:
       user_name =  os.getenv('REAL_USER')
-      if command:
-       print &quot;&#27491;&#22312;&#28858;&#30070;&#21069;&#20351;&#29992;&#32773;&quot; + message + &quot;...&quot;
-       os.system(&quot;su -c &quot; + user_name + &quot; &quot; + command)
+      if options.command:
+       print &quot;&#27491;&#22312;&#28858;&#30070;&#21069;&#20351;&#29992;&#32773;&quot; , options.message , &quot;...&quot;
+       os.system(&quot;su -c &quot; + user_name + &quot; &quot; + options.command)
       else: 
        print user_name
     elif alluser:
-      if command:
-       print &quot;&#27491;&#22312;&#28858;&#25152;&#26377;&#20351;&#29992;&#32773;&quot; + message + &quot;...&quot;
+      if options.command:
+       print &quot;&#27491;&#22312;&#28858;&#25152;&#26377;&#20351;&#29992;&#32773;&quot; , options.message , &quot;...&quot;
        for user_name in USERS_LIST:
-        os.system(&quot;su -c &quot; + user_name + &quot; &quot; + command)
+        os.system(&quot;su -c &quot; + user_name + &quot; &quot; + options.command)
       else:
        for user_name in USERS_LIST:
         print user_name,</diff>
      <filename>Common/sel_user.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>71a0379233f3e9177f00c38a82aefa3e4c5ccac4</id>
    </parent>
  </parents>
  <author>
    <name>billy3321</name>
    <email>billy3321@gmail.com</email>
  </author>
  <url>http://github.com/billy3321/lazyscripts_pool_debian_ubuntu/commit/009acb1fae91a6c837199fbc41d63b22c785b445</url>
  <id>009acb1fae91a6c837199fbc41d63b22c785b445</id>
  <committed-date>2009-08-31T04:55:35-07:00</committed-date>
  <authored-date>2009-08-31T04:55:35-07:00</authored-date>
  <message>use optparse instead of getopt</message>
  <tree>122f1f3b757dd6c4e2170d5acef35028d76b5ce1</tree>
  <committer>
    <name>billy3321</name>
    <email>billy3321@gmail.com</email>
  </committer>
</commit>
