summaryrefslogtreecommitdiff
path: root/coverage/cmdline.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:17:00 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:17:00 -0400
commit12d797137057ea428148fb4002745adcbe31daaa (patch)
treefa1a8f100d18451e1782537c451886c25623ce7c /coverage/cmdline.py
parent610eb85f1885a43c3331437dc8c88da388739c22 (diff)
downloadpython-coveragepy-git-12d797137057ea428148fb4002745adcbe31daaa.tar.gz
Help should focus on the new command syntax but also have a way to get help on the old.
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r--coverage/cmdline.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index d421aabe..b34c4b1d 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -309,8 +309,11 @@ class CoverageScript:
import re
topic_list = re.split("(?m)^=+ (\w+) =+$", HELP_TOPICS)
topics = dict(zip(topic_list[1::2], topic_list[2::2]))
- help_msg = topics[topic].strip()
- print(help_msg % self.covpkg.__dict__)
+ help_msg = topics.get(topic, '').strip()
+ if help_msg:
+ print(help_msg % self.covpkg.__dict__)
+ else:
+ print("Don't know topic %r" % topic)
def command_line(self, argv):
"""The bulk of the command line interface to Coverage.
@@ -347,7 +350,7 @@ class CoverageScript:
# Handle help.
if options.help:
if classic:
- self.help_fn(topic='classic_usage')
+ self.help_fn(topic='help')
else:
self.help_fn(parser=parser)
return OK
@@ -358,6 +361,8 @@ class CoverageScript:
parser = CMDS.get(a)
if parser:
self.help_fn(parser=parser)
+ else:
+ self.help_fn(topic=a)
else:
self.help_fn(topic='help')
return OK
@@ -476,7 +481,7 @@ class CoverageScript:
HELP_TOPICS = r"""
-== classic_usage ==============================================================
+== classic ====================================================================
Coverage version %(__version__)s
Measure, collect, and report on code coverage in Python programs.
@@ -519,8 +524,6 @@ coverage -a [-d DIR] [-i] [-o DIR,...] [FILE1 FILE2 ...]
a directory listed in the omit list.
e.g. coverage -i -r -o c:\python25,lib\enthought\traits
--h Print this help.
-
Coverage data is saved in the file .coverage by default. Set the
COVERAGE_FILE environment variable to save it somewhere else.
@@ -540,7 +543,8 @@ Commands:
run Run a Python program and measure code execution.
xml Create an XML report of coverage results.
-Use "coverage help <command>" for detailed help on each command.
+Use "coverage help <command>" for detailed help on any command.
+Use "coverage help classic" for help on older command syntax.
For more information, see %(__url__)s
== minimum_help ===============================================================