r26618: Implement -W option support.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 28 Dec 2007 21:36:55 +0000 (15:36 -0600)
committerStefan Metzmacher <metze@samba.org>
Fri, 28 Dec 2007 15:42:01 +0000 (09:42 -0600)
source/scripting/python/samba/getopt.py

index 014dd336d848e96a934c26fa1702bb245f3c84c6..87cf171ca2de69f24b81da2afed01df8cfa514ab 100644 (file)
@@ -42,12 +42,18 @@ class CredentialsOptions(optparse.OptionGroup):
                         help="Password", type=str, callback=self.set_password)
         self.add_option("-U", "--username", metavar="USERNAME", 
                         action="callback", type=str,
-                        help="username", callback=self.parse_username)
+                        help="Username", callback=self.parse_username)
+        self.add_option("-W", "--workgroup", metavar="WORKGROUP", 
+                        action="callback", type=str,
+                        help="Workgroup", callback=self.parse_workgroup)
         self.creds = Credentials()
 
     def parse_username(self, option, opt_str, arg, parser):
         self.creds.parse_string(arg)
 
+    def parse_workgroup(self, option, opt_str, arg, parser):
+        self.creds.set_domain(arg)
+
     def set_password(self, option, opt_str, arg, parser):
         self.creds.set_password(arg)