diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-10-21 17:31:27 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-10-21 17:31:27 -0400 |
commit | bf86427e1861aa353d7e80de0d373d9a30edb462 (patch) | |
tree | d8e24d69795d6c3096ed0af65d64eec4d3fd09b0 /coverage/cmdline.py | |
parent | 8271bf4c4d5272043677f37a65e16d21621133cb (diff) | |
download | python-coveragepy-git-bf86427e1861aa353d7e80de0d373d9a30edb462.tar.gz |
Always include a documentation link at the end of help messages
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r-- | coverage/cmdline.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index d04da399..23107c01 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -548,23 +548,27 @@ class CoverageScript(object): def help(self, error=None, topic=None, parser=None): """Display an error message, or the named topic.""" assert error or topic or parser + + help_params = dict(self.covpkg.__dict__) + help_params['program_name'] = self.program_name + if CTracer is not None: + help_params['extension_modifier'] = 'with C extension' + else: + help_params['extension_modifier'] = 'without C extension' + if error: print(error, file=sys.stderr) print("Use '%s help' for help." % (self.program_name,), file=sys.stderr) elif parser: print(parser.format_help().strip()) + print() else: - help_params = dict(self.covpkg.__dict__) - help_params['program_name'] = self.program_name - if CTracer is not None: - help_params['extension_modifier'] = 'with C extension' - else: - help_params['extension_modifier'] = 'without C extension' help_msg = textwrap.dedent(HELP_TOPICS.get(topic, '')).strip() if help_msg: print(help_msg.format(**help_params)) else: print("Don't know topic %r" % topic) + print("Full documentation is at {__url__}".format(**help_params)) def do_help(self, options, args, parser): """Deal with help requests. @@ -744,7 +748,6 @@ HELP_TOPICS = { xml Create an XML report of coverage results. Use "{program_name} help <command>" for detailed help on any command. - For full documentation, see {__url__} """, 'minimum_help': """\ @@ -753,7 +756,6 @@ HELP_TOPICS = { 'version': """\ Coverage.py, version {__version__} {extension_modifier} - Documentation at {__url__} """, } |