summaryrefslogtreecommitdiff
path: root/gbp/config.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-03-27 21:22:25 +0100
committerGuido Günther <agx@sigxcpu.org>2014-03-27 21:22:25 +0100
commite1780f0e457e9dbdba6d6f1b0c5cb3e4780cf7f7 (patch)
treed349a6098c5764d3a879fc705a011adc09e3f7c1 /gbp/config.py
parentbbf21bf366ff0d248f9c06b1cff600f339b8655e (diff)
Fix command output
The first line lacked the subcommand like: $ gbp pull --help Usage: gbp [options] - safely update a repository from remote instead of $ gbp pull --help Usage: gbp pull [options] - safely update a repository from remote ^^^^
Diffstat (limited to 'gbp/config.py')
-rw-r--r--gbp/config.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/gbp/config.py b/gbp/config.py
index fa6e679..9ac1ee8 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -20,6 +20,7 @@ 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:
@@ -356,7 +357,7 @@ class GbpOptionParser(OptionParser):
else:
self.config['filter'] = []
- def __init__(self, command, prefix='', usage=None, sections=[]):
+ def __init__(self, command=None, prefix='', usage=None, sections=[]):
"""
@param command: the command to build the config parser for
@type command: C{str}
@@ -368,6 +369,10 @@ 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
@@ -375,6 +380,7 @@ class GbpOptionParser(OptionParser):
self.config_files = self.get_config_files()
self._parse_config_files()
OptionParser.__init__(self, option_class=GbpOption,
+ prog=command,
usage=usage, version='%s %s' % (self.command,
gbp_version))