From 28bd80812f9b81f5eccf3abcfd885a353d3fdf56 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Thu, 20 Jan 2011 23:59:13 -0800 Subject: [PATCH] Change --version and --version-and-path to not exit immediately, if a command is given. --- src/allmydata/scripts/common.py | 10 ++++++---- src/allmydata/scripts/runner.py | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py index 5eb31477..4fa217ca 100644 --- a/src/allmydata/scripts/common.py +++ b/src/allmydata/scripts/common.py @@ -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: diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index 1cd8a712..50f2f07a 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -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 = {} -- 2.45.2