]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Change --version and --version-and-path to not exit immediately, if a command is...
authordavid-sarah <david-sarah@jacaranda.org>
Fri, 21 Jan 2011 07:59:13 +0000 (23:59 -0800)
committerdavid-sarah <david-sarah@jacaranda.org>
Fri, 21 Jan 2011 07:59:13 +0000 (23:59 -0800)
src/allmydata/scripts/common.py
src/allmydata/scripts/runner.py

index 5eb31477f1d80813cc977119169787b6df45d87d..4fa217caca2f61fba67a488200934629042f9d09 100644 (file)
@@ -32,8 +32,8 @@ class BaseOptions(usage.Options):
 
     optFlags = [
         ["quiet", "q", "Operate silently."],
-        ["version", "V", "Display version numbers and exit."],
-        ["version-and-path", None, "Display version numbers and paths to their locations and exit."],
+        ["version", "V", "Display version numbers."],
+        ["version-and-path", None, "Display version numbers and paths to their locations."],
     ]
     optParameters = [
         ["node-directory", "d", None, "Specify which Tahoe node directory should be used." + (
@@ -43,12 +43,14 @@ class BaseOptions(usage.Options):
     def opt_version(self):
         import allmydata
         print >>self.stdout, allmydata.get_package_versions_string()
-        sys.exit(0)
+        print >>self.stdout
+        self.no_command_needed = True
 
     def opt_version_and_path(self):
         import allmydata
         print >>self.stdout, allmydata.get_package_versions_string(show_paths=True)
-        sys.exit(0)
+        print >>self.stdout
+        self.no_command_needed = True
 
 
 class BasedirMixin:
index 1cd8a7124d65c7ba19d207b9401cdc73c4675c6a..50f2f07af663f98656a1c74e1223f7a7ffb3e4b2 100644 (file)
@@ -35,7 +35,9 @@ class Options(BaseOptions, usage.Options):
 
     def postOptions(self):
         if not hasattr(self, 'subOptions'):
-            raise usage.UsageError("must specify a command")
+            if not hasattr(self, 'no_command_needed'):
+                raise usage.UsageError("must specify a command")
+            sys.exit(0)
 
 
 create_dispatch = {}