mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-19 15:53:48 +00:00
scripts: improve rendering of synopsis/usage
Subcommands "--help" is now rendered as: ``` tahoe [global-options] COMMAND [options] ARGS (use 'tahoe --help' to view global options) USAGE (flags/options) DESCRIPTION DESCRIPTION_UNWRAPPED ``` The new .description and .description_unwrapped fields allow commands (subclasses of twisted.python.usage.Usage) better control over how their explanations are rendered: the old .longdesc field was wrapped unpleasantly.
This commit is contained in:
@ -66,11 +66,15 @@ class Options(usage.Options):
|
||||
print >>self.stdout, allmydata.get_package_versions_string(show_paths=True, debug=True)
|
||||
self.no_command_needed = True
|
||||
|
||||
def getSynopsis(self):
|
||||
return "\nUsage: tahoe [global-opts] <command> [command-options]"
|
||||
def __str__(self):
|
||||
return ("\nUsage: tahoe [global-options] <command> [command-options]\n"
|
||||
+ self.getUsage())
|
||||
|
||||
synopsis = "\nUsage: tahoe [global-opts]" # used only for subcommands
|
||||
|
||||
def getUsage(self, **kwargs):
|
||||
t = usage.Options.getUsage(self, **kwargs)
|
||||
t = t.replace("Options:", "\nGlobal options:", 1)
|
||||
return t + "\nPlease run 'tahoe <command> --help' for more details on each command.\n"
|
||||
|
||||
def postOptions(self):
|
||||
|
Reference in New Issue
Block a user