diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-09-25 13:34:04 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-09-25 13:34:04 +0000 |
commit | 3d93d272079b602aefe5d3bcd660d4a3307f3aad (patch) | |
tree | 046f9fd43bf469bb34626bf98c5718797fe77222 /morphlib | |
parent | dd9a5ba2f78560ae1529f8f3a1ed238e4eefa720 (diff) | |
parent | 323de5b34000982dcee5f158b81d1a8d62892ce7 (diff) | |
download | morph-3d93d272079b602aefe5d3bcd660d4a3307f3aad.tar.gz |
Merge branch 'baserock/larswirzenius/S8698-morph-help-fmt'
Reviewed-by: Richard Maw
Reviewed-by: Pedro Alvarez
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/app.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 0890a786..08b020ff 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -418,3 +418,28 @@ class Morph(cliapp.Application): # run the command line return cliapp.Application.runcmd(self, argv, *args, **kwargs) + + # FIXME: This overrides a private method in cliapp. We need + # get cliapp to provide the necessary hooks to do this cleanly. + # As it is, this is a copy of the method in cliapp, with the + # single change that for subcommand helps, the formatting is + # not used. + def _help_helper(self, args, show_all): # pragma: no cover + try: + width = int(os.environ.get('COLUMNS', '78')) + except ValueError: + width = 78 + + fmt = cliapp.TextFormat(width=width) + + if args: + usage = self._format_usage_for(args[0]) + description = self._format_subcommand_help(args[0]) + text = '%s\n\n%s' % (usage, description) + else: + usage = self._format_usage(all=show_all) + description = fmt.format(self._format_description(all=show_all)) + text = '%s\n\n%s' % (usage, description) + + text = self.settings.progname.join(text.split('%prog')) + self.output.write(text) |