From: Brian Warner Date: Mon, 18 Jun 2012 17:44:39 +0000 (-0700) Subject: CLI: put "[global-opts]" in all command synopses X-Git-Tag: allmydata-tahoe-1.10b1~14 X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/simplejson/something?a=commitdiff_plain;h=3ee950f09ed8b7f6cc72a98c26eefe9e02c11d85;p=tahoe-lafs%2Ftahoe-lafs.git CLI: put "[global-opts]" in all command synopses --- diff --git a/src/allmydata/scripts/admin.py b/src/allmydata/scripts/admin.py index 1a6c9854..092d90a9 100644 --- a/src/allmydata/scripts/admin.py +++ b/src/allmydata/scripts/admin.py @@ -4,7 +4,7 @@ from allmydata.scripts.common import BaseOptions class GenerateKeypairOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe admin generate-keypair" + return "Usage: tahoe [global-opts] admin generate-keypair" def getUsage(self, width=None): t = BaseOptions.getUsage(self, width) @@ -26,7 +26,7 @@ class DerivePubkeyOptions(BaseOptions): self.privkey = privkey def getSynopsis(self): - return "Usage: tahoe admin derive-pubkey PRIVKEY" + return "Usage: tahoe [global-opts] admin derive-pubkey PRIVKEY" def getUsage(self, width=None): t = BaseOptions.getUsage(self, width) @@ -57,7 +57,7 @@ class AdminCommand(BaseOptions): if not hasattr(self, 'subOptions'): raise usage.UsageError("must specify a subcommand") def getSynopsis(self): - return "Usage: tahoe admin SUBCOMMAND" + return "Usage: tahoe [global-opts] admin SUBCOMMAND" def getUsage(self, width=None): t = BaseOptions.getUsage(self, width) t += """ diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index ec64039e..9fd2dad2 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -58,7 +58,7 @@ class MakeDirectoryOptions(FilesystemOptions): raise usage.UsageError("%s is an invalid format" % self['format']) def getSynopsis(self): - return "Usage: %s mkdir [options] [REMOTE_DIR]" % (self.command_name,) + return "Usage: %s [global-opts] mkdir [options] [REMOTE_DIR]" % (self.command_name,) longdesc = """Create a new directory, either unlinked or as a subdirectory.""" @@ -70,7 +70,7 @@ class AddAliasOptions(FilesystemOptions): self.cap = cap def getSynopsis(self): - return "Usage: %s add-alias [options] ALIAS[:] DIRCAP" % (self.command_name,) + return "Usage: %s [global-opts] add-alias [options] ALIAS[:] DIRCAP" % (self.command_name,) longdesc = """Add a new alias for an existing directory.""" @@ -81,13 +81,13 @@ class CreateAliasOptions(FilesystemOptions): self.alias = self.alias[:-1] def getSynopsis(self): - return "Usage: %s create-alias [options] ALIAS[:]" % (self.command_name,) + return "Usage: %s [global-opts] create-alias [options] ALIAS[:]" % (self.command_name,) longdesc = """Create a new directory and add an alias for it.""" class ListAliasesOptions(FilesystemOptions): def getSynopsis(self): - return "Usage: %s list-aliases [options]" % (self.command_name,) + return "Usage: %s [global-opts] list-aliases [options]" % (self.command_name,) longdesc = """Display a table of all configured aliases.""" @@ -151,7 +151,7 @@ class GetOptions(FilesystemOptions): self.to_file = None def getSynopsis(self): - return "Usage: %s get [options] REMOTE_FILE LOCAL_FILE" % (self.command_name,) + return "Usage: %s [global-opts] get [options] REMOTE_FILE LOCAL_FILE" % (self.command_name,) longdesc = """ Retrieve a file from the grid and write it to the local filesystem. If @@ -197,7 +197,7 @@ class PutOptions(FilesystemOptions): raise usage.UsageError("%s is an invalid format" % self['format']) def getSynopsis(self): - return "Usage: %s put [options] LOCAL_FILE REMOTE_FILE" % (self.command_name,) + return "Usage: %s [global-opts] put [options] LOCAL_FILE REMOTE_FILE" % (self.command_name,) longdesc = """ Put a file into the grid, copying its contents from the local filesystem. @@ -240,7 +240,7 @@ class CpOptions(FilesystemOptions): self.destination = argv_to_unicode(args[-1]) def getSynopsis(self): - return "Usage: %s cp [options] FROM.. TO" % (self.command_name,) + return "Usage: %s [global-opts] cp [options] FROM.. TO" % (self.command_name,) longdesc = """ Use 'tahoe cp' to copy files between a local filesystem and a Tahoe grid. @@ -272,11 +272,11 @@ class UnlinkOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s unlink [options] REMOTE_FILE" % (self.command_name,) + return "Usage: %s [global-opts] unlink [options] REMOTE_FILE" % (self.command_name,) class RmOptions(UnlinkOptions): def getSynopsis(self): - return "Usage: %s rm [options] REMOTE_FILE" % (self.command_name,) + return "Usage: %s [global-opts] rm [options] REMOTE_FILE" % (self.command_name,) class MvOptions(FilesystemOptions): def parseArgs(self, frompath, topath): @@ -284,7 +284,7 @@ class MvOptions(FilesystemOptions): self.to_file = argv_to_unicode(topath) def getSynopsis(self): - return "Usage: %s mv [options] FROM TO" % (self.command_name,) + return "Usage: %s [global-opts] mv [options] FROM TO" % (self.command_name,) longdesc = """ Use 'tahoe mv' to move files that are already on the grid elsewhere on @@ -304,7 +304,7 @@ class LnOptions(FilesystemOptions): self.to_file = argv_to_unicode(topath) def getSynopsis(self): - return "Usage: %s ln [options] FROM_LINK TO_LINK" % (self.command_name,) + return "Usage: %s [global-opts] ln [options] FROM_LINK TO_LINK" % (self.command_name,) longdesc = """ Use 'tahoe ln' to duplicate a link (directory entry) already on the grid @@ -351,7 +351,7 @@ class BackupOptions(FilesystemOptions): self.to_dir = argv_to_unicode(topath) def getSynopsis(self): - return "Usage: %s backup [options] FROM ALIAS:TO" % (self.command_name,) + return "Usage: %s [global-opts] backup [options] FROM ALIAS:TO" % (self.command_name,) def opt_exclude(self, pattern): """Ignore files matching a glob pattern. You may give multiple @@ -409,7 +409,7 @@ class WebopenOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s webopen [options] [ALIAS:PATH]" % (self.command_name,) + return "Usage: %s [global-opts] webopen [options] [ALIAS:PATH]" % (self.command_name,) longdesc = """Open a web browser to the contents of some file or directory on the grid. When run without arguments, open the Welcome @@ -426,7 +426,7 @@ class ManifestOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s manifest [options] [ALIAS:PATH]" % (self.command_name,) + return "Usage: %s [global-opts] manifest [options] [ALIAS:PATH]" % (self.command_name,) longdesc = """Print a list of all files and directories reachable from the given starting point.""" @@ -439,7 +439,7 @@ class StatsOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s stats [options] [ALIAS:PATH]" % (self.command_name,) + return "Usage: %s [global-opts] stats [options] [ALIAS:PATH]" % (self.command_name,) longdesc = """Print statistics about of all files and directories reachable from the given starting point.""" @@ -455,7 +455,7 @@ class CheckOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s check [options] [ALIAS:PATH]" % (self.command_name,) + return "Usage: %s [global-opts] check [options] [ALIAS:PATH]" % (self.command_name,) longdesc = """ Check a single file or directory: count how many shares are available and @@ -474,7 +474,7 @@ class DeepCheckOptions(FilesystemOptions): self.where = argv_to_unicode(where) def getSynopsis(self): - return "Usage: %s deep-check [options] [ALIAS:PATH]" % (self.command_name,) + return "Usage: %s [global-opts] deep-check [options] [ALIAS:PATH]" % (self.command_name,) longdesc = """ Check all files and directories reachable from the given starting point diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py index 893bf08c..a27ed827 100644 --- a/src/allmydata/scripts/create_node.py +++ b/src/allmydata/scripts/create_node.py @@ -17,7 +17,7 @@ class CreateClientOptions(BasedirOptions): ] def getSynopsis(self): - return "Usage: %s create-client [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] create-client [options] [NODEDIR]" % (self.command_name,) class CreateNodeOptions(CreateClientOptions): @@ -26,14 +26,14 @@ class CreateNodeOptions(CreateClientOptions): ] def getSynopsis(self): - return "Usage: %s create-node [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] create-node [options] [NODEDIR]" % (self.command_name,) class CreateIntroducerOptions(BasedirOptions): default_nodedir = None def getSynopsis(self): - return "Usage: %s create-introducer [options] NODEDIR" % (self.command_name,) + return "Usage: %s [global-opts] create-introducer [options] NODEDIR" % (self.command_name,) client_tac = """ diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index cb8e986a..34afbc1f 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -11,7 +11,7 @@ from allmydata.scripts.common import BaseOptions class DumpOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe debug dump-share SHARE_FILENAME" + return "Usage: tahoe [global-opts] debug dump-share SHARE_FILENAME" optFlags = [ ["offsets", None, "Display a table of section offsets."], @@ -408,7 +408,7 @@ def dump_MDMF_share(m, length, options): class DumpCapOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe debug dump-cap [options] FILECAP" + return "Usage: tahoe [global-opts] debug dump-cap [options] FILECAP" optParameters = [ ["nodeid", "n", None, "Specify the storage server nodeid (ASCII), to construct WE and secrets."], @@ -610,7 +610,7 @@ def dump_uri_instance(u, nodeid, secret, out, show_header=True): class FindSharesOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe debug find-shares STORAGE_INDEX NODEDIRS.." + return "Usage: tahoe [global-opts] debug find-shares STORAGE_INDEX NODEDIRS.." def parseArgs(self, storage_index_s, *nodedirs): from allmydata.util.encodingutil import argv_to_abspath @@ -669,7 +669,7 @@ class CatalogSharesOptions(BaseOptions): raise usage.UsageError("must specify at least one node directory") def getSynopsis(self): - return "Usage: tahoe debug catalog-shares NODEDIRS.." + return "Usage: tahoe [global-opts] debug catalog-shares NODEDIRS.." def getUsage(self, width=None): t = BaseOptions.getUsage(self, width) @@ -882,7 +882,7 @@ def catalog_shares_one_abbrevdir(si_s, si_dir, now, out, err): class CorruptShareOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe debug corrupt-share SHARE_FILENAME" + return "Usage: tahoe [global-opts] debug corrupt-share SHARE_FILENAME" optParameters = [ ["offset", "o", "block-random", "Specify which bit to flip."], @@ -962,7 +962,7 @@ def corrupt_share(options): class ReplOptions(BaseOptions): def getSynopsis(self): - return "Usage: tahoe debug repl" + return "Usage: tahoe [global-opts] debug repl" def repl(options): import code @@ -973,7 +973,7 @@ DEFAULT_TESTSUITE = 'allmydata' class TrialOptions(twisted_trial.Options): def getSynopsis(self): - return "Usage: tahoe debug trial [options] [[file|package|module|TestCase|testmethod]...]" + return "Usage: tahoe [global-opts] debug trial [options] [[file|package|module|TestCase|testmethod]...]" def parseOptions(self, all_subargs, *a, **kw): self.trial_args = list(all_subargs) @@ -1006,9 +1006,9 @@ def fixOptionsClass( (subcmd, shortcut, OptionsClass, desc) ): t = OptionsClass.getSynopsis(self) i = t.find("Usage: flogtool ") if i >= 0: - return "Usage: tahoe debug flogtool " + t[i+len("Usage: flogtool "):] + return "Usage: tahoe [global-opts] debug flogtool " + t[i+len("Usage: flogtool "):] else: - return "Usage: tahoe debug flogtool %s [options]" % (subcmd,) + return "Usage: tahoe [global-opts] debug flogtool %s [options]" % (subcmd,) return (subcmd, shortcut, FixedOptionsClass, desc) class FlogtoolOptions(foolscap_cli.Options): @@ -1017,7 +1017,7 @@ class FlogtoolOptions(foolscap_cli.Options): self.subCommands = map(fixOptionsClass, self.subCommands) def getSynopsis(self): - return "Usage: tahoe debug flogtool (%s) [command options]" % ("|".join([x[0] for x in self.subCommands])) + return "Usage: tahoe [global-opts] debug flogtool (%s) [command options]" % ("|".join([x[0] for x in self.subCommands])) def parseOptions(self, all_subargs, *a, **kw): self.flogtool_args = list(all_subargs) diff --git a/src/allmydata/scripts/keygen.py b/src/allmydata/scripts/keygen.py index 5b1c9ab5..0982b0d8 100644 --- a/src/allmydata/scripts/keygen.py +++ b/src/allmydata/scripts/keygen.py @@ -8,7 +8,7 @@ class CreateKeyGeneratorOptions(BasedirOptions): default_nodedir = None def getSynopsis(self): - return "Usage: %s create-key-generator [options] NODEDIR" % (self.command_name,) + return "Usage: %s [global-opts] create-key-generator [options] NODEDIR" % (self.command_name,) keygen_tac = """ diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index c89a2f45..08596707 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -67,7 +67,7 @@ class Options(usage.Options): self.no_command_needed = True def getSynopsis(self): - return "\nUsage: tahoe [global-options] [command-options]" + return "\nUsage: tahoe [global-opts] [command-options]" def getUsage(self, **kwargs): t = usage.Options.getUsage(self, **kwargs) diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py index 36138e00..9ecbf069 100644 --- a/src/allmydata/scripts/startstop_node.py +++ b/src/allmydata/scripts/startstop_node.py @@ -13,12 +13,12 @@ class StartOptions(BasedirOptions): ] def getSynopsis(self): - return "Usage: %s start [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] start [options] [NODEDIR]" % (self.command_name,) class StopOptions(BasedirOptions): def getSynopsis(self): - return "Usage: %s stop [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] stop [options] [NODEDIR]" % (self.command_name,) class RestartOptions(BasedirOptions): @@ -28,14 +28,14 @@ class RestartOptions(BasedirOptions): ] def getSynopsis(self): - return "Usage: %s restart [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] restart [options] [NODEDIR]" % (self.command_name,) class RunOptions(BasedirOptions): default_nodedir = u"." def getSynopsis(self): - return "Usage: %s run [options] [NODEDIR]" % (self.command_name,) + return "Usage: %s [global-opts] run [options] [NODEDIR]" % (self.command_name,) def start(opts, out=sys.stdout, err=sys.stderr): diff --git a/src/allmydata/scripts/stats_gatherer.py b/src/allmydata/scripts/stats_gatherer.py index bdb35766..7762b2c5 100644 --- a/src/allmydata/scripts/stats_gatherer.py +++ b/src/allmydata/scripts/stats_gatherer.py @@ -8,7 +8,7 @@ class CreateStatsGathererOptions(BasedirOptions): default_nodedir = None def getSynopsis(self): - return "Usage: %s create-stats-gatherer [options] NODEDIR" % (self.command_name,) + return "Usage: %s [global-opts] create-stats-gatherer [options] NODEDIR" % (self.command_name,) stats_gatherer_tac = """