Change --version and --version-and-path to not exit immediately, if a command is given.
This commit is contained in:
parent
f3b4f4181c
commit
28bd80812f
|
@ -32,8 +32,8 @@ class BaseOptions(usage.Options):
|
||||||
|
|
||||||
optFlags = [
|
optFlags = [
|
||||||
["quiet", "q", "Operate silently."],
|
["quiet", "q", "Operate silently."],
|
||||||
["version", "V", "Display version numbers and exit."],
|
["version", "V", "Display version numbers."],
|
||||||
["version-and-path", None, "Display version numbers and paths to their locations and exit."],
|
["version-and-path", None, "Display version numbers and paths to their locations."],
|
||||||
]
|
]
|
||||||
optParameters = [
|
optParameters = [
|
||||||
["node-directory", "d", None, "Specify which Tahoe node directory should be used." + (
|
["node-directory", "d", None, "Specify which Tahoe node directory should be used." + (
|
||||||
|
@ -43,12 +43,14 @@ class BaseOptions(usage.Options):
|
||||||
def opt_version(self):
|
def opt_version(self):
|
||||||
import allmydata
|
import allmydata
|
||||||
print >>self.stdout, allmydata.get_package_versions_string()
|
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):
|
def opt_version_and_path(self):
|
||||||
import allmydata
|
import allmydata
|
||||||
print >>self.stdout, allmydata.get_package_versions_string(show_paths=True)
|
print >>self.stdout, allmydata.get_package_versions_string(show_paths=True)
|
||||||
sys.exit(0)
|
print >>self.stdout
|
||||||
|
self.no_command_needed = True
|
||||||
|
|
||||||
|
|
||||||
class BasedirMixin:
|
class BasedirMixin:
|
||||||
|
|
|
@ -35,7 +35,9 @@ class Options(BaseOptions, usage.Options):
|
||||||
|
|
||||||
def postOptions(self):
|
def postOptions(self):
|
||||||
if not hasattr(self, 'subOptions'):
|
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 = {}
|
create_dispatch = {}
|
||||||
|
|
Loading…
Reference in New Issue