[tor-commits] [arm/master] Using new argument parsing in parallel with the old version

atagar at torproject.org atagar at torproject.org
Sun Sep 15 22:29:20 UTC 2013


commit a4e399176efaa9c5ff379e1fe3142a01864ea15d
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 8 14:32:02 2013 -0700

    Using new argument parsing in parallel with the old version
    
    Calling our new arg parsing funciton, though for the moment ignoring its
    output. Functionally this adds the validation it does, and nothing more. Next I
    plan to replace the old arguments one by one...
---
 arm/starter.py |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arm/starter.py b/arm/starter.py
index bae9a64..37c048d 100644
--- a/arm/starter.py
+++ b/arm/starter.py
@@ -315,10 +315,19 @@ def main():
   param = dict([(key, None) for key in CONFIG.keys()])
   isDebugMode = False
   configPath = DEFAULT_CONFIG # path used for customized configuration
-  
+
+  try:
+    args = _get_args(sys.argv[1:])
+  except getopt.GetoptError as exc:
+    print "%s (for usage provide --help)" % exc
+    sys.exit(1)
+  except ValueError as exc:
+    print exc
+    sys.exit(1)
+
   # parses user input, noting any issues
   try:
-    opts, args = getopt.getopt(sys.argv[1:], OPT, OPT_EXPANDED)
+    opts, _ = getopt.getopt(sys.argv[1:], OPT, OPT_EXPANDED)
   except getopt.GetoptError, exc:
     print str(exc) + " (for usage provide --help)"
     sys.exit()





More information about the tor-commits mailing list