diff options
author | Ben Finney <ben+python@benfinney.id.au> | 2015-10-18 12:58:20 +1100 |
---|---|---|
committer | Ben Finney <ben+python@benfinney.id.au> | 2015-10-18 12:58:20 +1100 |
commit | 192aae2ee24eeacce209b208916528086ab3a229 (patch) | |
tree | 19ea39107e10d5a04836207bae4fc8857f7b997c /coverage/cmdline.py | |
parent | e0a8af19e0a4434943212594b07de3f4056e5e86 (diff) | |
download | python-coveragepy-192aae2ee24eeacce209b208916528086ab3a229.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.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 94bb75f..308dbac 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, |