[Nym3-commit] r160 - trunk/nym3/Client

laurent at komite.net laurent at komite.net
Fri Feb 18 22:20:26 CET 2005


Author: laurent
Date: 2005-02-18 22:20:25 +0100 (Fri, 18 Feb 2005)
New Revision: 160

Modified:
   trunk/nym3/Client/Main.py
Log:
Some getopt cleaning. Check for required args.


Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py	2005-02-11 16:54:29 UTC (rev 159)
+++ trunk/nym3/Client/Main.py	2005-02-18 21:20:25 UTC (rev 160)
@@ -81,8 +81,8 @@
     
     #TODO put here options common to every command
     parser.add_option("-D", "--debug", action = "callback", 
-		      callback = setDebug, help = "output message on stdout\
-		      instead of sending them through mixminion")
+		      callback = setDebug, help = "output message on stdout "
+		      "instead of sending them through mixminion")
     userOption = make_option("-u", "--user", action = "callback", 
 			     callback = setUser, type = "string",
 			     help = "determine the user account to be used")
@@ -90,17 +90,23 @@
     # how helpful is that supposed to be to the user?
     taggedUserOption = make_option("-t", "--tag", action = "callback", 
 				   callback = setUserTagged,
-				   type = "string", help = "determine the\
-				   user account to be used from a tag")
+				   type = "string", help = "determine the "
+				   "user account to be used from a tag")
     
+    if len(sys.argv) < 2:
+	print "Usage: nymclient <command> [arguments]"
+	sys.exit(1)
     if sys.argv[1] == 'setup':
         parser.usage = "%prog setup [options] server nym1 [nym2 [...]]"
         parser.add_option("-t", "--tag", dest = "tag", default = "", 
-	    help = "the tag that the user wish to associate with \
-	    the new account")
+	    help = "the tag that the user wish to associate with "
+	    "the new account")
         parser.add_option("-a", "--address", dest = "address", default = "", 
 	    help = "the address to which the surbs point")
         (options, args) = parser.parse_args(sys.argv[2:])
+	if len(args) < 1:
+	    parser.print_help()
+	    sys.exit(1)
         nymUser = User.User(tag = options.tag, create = 1)
         nymUser.setAddress(options.address)
         nymUser.generateKeys()



More information about the Nym3-commit mailing list