summaryrefslogtreecommitdiff
path: root/coverage/cmdline.py
diff options
context:
space:
mode:
authorBen Finney <ben+python@benfinney.id.au>2015-10-18 12:58:20 +1100
committerBen Finney <ben+python@benfinney.id.au>2015-10-18 12:58:20 +1100
commit39683d80f2aea8412b805aa71a41e625c388b223 (patch)
tree0533f3f922a88b4d4011fa90eed7ab95deaa4b70 /coverage/cmdline.py
parent8d622d2b2a73e7805ed09804656f2258a0d5273f (diff)
downloadpython-coveragepy-git-39683d80f2aea8412b805aa71a41e625c388b223.tar.gz
Override program name only for ‘CmdOptionParser’ instances.
We only need to append the sub-command, so we shouldn't override the actual command. Get the command from the superclass.
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r--coverage/cmdline.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index 94bb75f2..308dbacc 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -230,7 +230,6 @@ class CmdOptionParser(CoverageOptionParser):
if usage:
usage = "%prog " + usage
super(CmdOptionParser, self).__init__(
- prog="%(program_name)s %s" % action,
usage=usage,
description=description,
)
@@ -244,6 +243,15 @@ class CmdOptionParser(CoverageOptionParser):
# results, and they will compare equal to objects.
return (other == "<CmdOptionParser:%s>" % self.cmd)
+ def get_prog_name(self):
+ program_name = super(CmdOptionParser, self).get_prog_name()
+
+ # Include the sub-command for this parser as part of the command.
+ result = "%(command)s %(subcommand)s" % {
+ 'command': program_name, 'subcommand': self.cmd}
+ return result
+
+
GLOBAL_ARGS = [
Opts.debug,
Opts.help,