diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-03-29 00:07:29 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-03-29 00:16:48 +0100 |
commit | 89f3005c606c80ff79ef7f52694104c891555ec3 (patch) | |
tree | 483a6759269ee5458d64360461c3b19a8f50c85d /gbp/config.py | |
parent | 8358f1dcc77633c97a096ef6a93998f4099237c4 (diff) |
Use a much simpler version to fix the command name in --help
mostly reverting e1780f0.
Closes: #742907
Diffstat (limited to 'gbp/config.py')
-rw-r--r-- | gbp/config.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gbp/config.py b/gbp/config.py index 9ac1ee8..93961a2 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -20,7 +20,6 @@ from optparse import OptionParser, OptionGroup, Option, OptionValueError from ConfigParser import SafeConfigParser, NoSectionError from copy import copy import os.path -import sys try: from gbp.version import gbp_version except ImportError: @@ -357,7 +356,7 @@ class GbpOptionParser(OptionParser): else: self.config['filter'] = [] - def __init__(self, command=None, prefix='', usage=None, sections=[]): + def __init__(self, command, prefix='', usage=None, sections=[]): """ @param command: the command to build the config parser for @type command: C{str} @@ -369,18 +368,19 @@ class GbpOptionParser(OptionParser): to parse @type sections: C{list} of C{str} """ - if not command: - command = os.path.basename(sys.argv[0]) - if command == 'gbp': - command += " " + os.path.basename(sys.argv[1]) self.command = command self.sections = sections self.prefix = prefix self.config = {} self.config_files = self.get_config_files() self._parse_config_files() + + if self.command.startswith('git-') or self.command.startswith('gbp-'): + prog = self.command + else: + prog = "gbp %s" % self.command OptionParser.__init__(self, option_class=GbpOption, - prog=command, + prog=prog, usage=usage, version='%s %s' % (self.command, gbp_version)) |