[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - app.py:1.14

Fred L. Drake, Jr. fred at zope.com
Thu Apr 1 20:04:35 EST 2004


Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv2601/zpkgtools

Modified Files:
	app.py 
Log Message:
More cleanup of the command line handling.


=== Packages/zpkgtools/zpkgtools/app.py 1.13 => 1.14 ===
--- Packages/zpkgtools/zpkgtools/app.py:1.13	Thu Apr  1 19:54:16 2004
+++ Packages/zpkgtools/zpkgtools/app.py	Thu Apr  1 20:04:02 2004
@@ -297,7 +297,7 @@
 
 def parse_args(argv):
     """Parse the command line, return an options object and the
-    positional arguments.
+    identifier of the resource to be packaged.
 
     :Parameters:
       - `argv`: The command line arguments, including argv[0].
@@ -337,23 +337,22 @@
         "-v", dest="version",
         help="version label for the new distribution",
         default="0.0.0")
-    return parser.parse_args(argv[1:])
+    options, args = parser.parse_args(argv[1:])
+    if len(args) != 1:
+        parser.error("wrong number of arguments")
+    return options, args[0]
 
 
 def main(argv=None):
     if argv is None:
         argv = sys.argv
     try:
-        options, args = parse_args(argv)
+        options, resource = parse_args(argv)
     except SystemExit, e:
         print >>sys.stderr, e
         return 2
 
     # figure out what to read from:
-    if len(args) != 1:
-        print >>sys.stderr, "wrong number of arguments"
-        return 2
-    resource = args[0]
     program = os.path.basename(argv[0])
 
     try:




More information about the Zope-CVS mailing list