[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Move parseNetTestOptions to oonicli



commit 9f1d820721d52a5d1f2e8aa00d3980e9c42226dd
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Sun Jan 13 10:34:38 2013 +0000

    Move parseNetTestOptions to oonicli
---
 ooni/oonicli.py |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index 4a638e0..d345a25 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -72,6 +72,28 @@ class Options(usage.Options):
         except:
             raise usage.UsageError("No test filename specified!")
 
+def parseNetTestOptions(obj, argv):
+    if not hasattr(obj.usageOptions, 'optParameters'):
+        obj.usageOptions.optParameters = []
+
+    if obj.inputFile:
+        obj.usageOptions.optParameters.append(obj.inputFile)
+
+    if obj.baseParameters:
+        for parameter in obj.baseParameters:
+            obj.usageOptions.optParameters.append(parameter)
+
+    if obj.baseFlags:
+        if not hasattr(obj.usageOptions, 'optFlags'):
+            obj.usageOptions.optFlags = []
+        for flag in obj.baseFlags:
+            obj.usageOptions.optFlags.append(flag)
+
+    options = obj.usageOptions()
+    options.parseOptions(argv)
+
+    return options
+
 def updateStatusBar():
     for test_filename in config.state.keys():
         # The ETA is not updated so we we will not print it out for the



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits