[Checkins] SVN: grokproject/branches/jw-fix-125817/grokproject/__init__.py Each of the interactive questions can now be set with an commandline

Jan-Wijbrand Kolman janwijbrand at gmail.com
Fri Nov 2 05:47:36 EDT 2007


Log message for revision 81407:
  Each of the interactive questions can now be set with an commandline
  option.

Changed:
  U   grokproject/branches/jw-fix-125817/grokproject/__init__.py

-=-
Modified: grokproject/branches/jw-fix-125817/grokproject/__init__.py
===================================================================
--- grokproject/branches/jw-fix-125817/grokproject/__init__.py	2007-11-02 09:44:45 UTC (rev 81406)
+++ grokproject/branches/jw-fix-125817/grokproject/__init__.py	2007-11-02 09:47:35 UTC (rev 81407)
@@ -55,11 +55,18 @@
                       "hierarchy).")
     parser.add_option('--newer', action="store_true", dest="newest",
                       default=False, help="Check for newer versions of packages.")
+    parser.add_option('-v', '--verbose', action="store_true", dest="verbose",
+                      default=False, help="Be verbose.")
     parser.add_option(
         '--version-info-url', dest="version_info_url", default=None,
         help="The URL to a *.cfg file containing a [versions] section.")
-    parser.add_option('-v', '--verbose', action="store_true", dest="verbose",
-                      default=False, help="Be verbose.")
+
+    # Options that override the interactive part of filling the templates.
+    for var in GrokProject.vars:
+        parser.add_option(
+            '--'+var.name.replace('_', '-'), dest=var.name,
+            help=var.description)
+
     options, args = parser.parse_args()
     if len(args) != 1:
         parser.print_usage()
@@ -83,6 +90,13 @@
     else:
         extra_args.append('newest=false')
 
+    # Process the options that override the interactive part of filling
+    # the templates.
+    for var in GrokProject.vars:
+        if parser.has_option(var.name):
+            extra_args.append(
+                '%s=%s' % (var.name, getattr(options, var.name)))
+
     version_info_url = options.version_info_url
     if not version_info_url:
         info = urllib.urlopen(VERSIONINFO_INFO_URL).read().strip()



More information about the Checkins mailing list