aboutsummaryrefslogtreecommitdiff
path: root/gbp/config.py
diff options
context:
space:
mode:
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))