aboutsummaryrefslogtreecommitdiff
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
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 ^^^^
-rw-r--r--gbp/config.py8
-rwxr-xr-xgbp/scripts/buildpackage.py2
-rwxr-xr-xgbp/scripts/clone.py3
-rw-r--r--gbp/scripts/create_remote_repo.py3
-rw-r--r--gbp/scripts/dch.py3
-rw-r--r--gbp/scripts/import_dsc.py3
-rw-r--r--gbp/scripts/import_orig.py3
-rwxr-xr-xgbp/scripts/pq.py3
-rwxr-xr-xgbp/scripts/pull.py3
9 files changed, 15 insertions, 16 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))
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 753ad64..0b14b3f 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -375,7 +375,7 @@ def parse_args(argv, prefix):
args.append(arg)
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix=prefix)
+ parser = GbpOptionParserDebian(prefix=prefix)
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None, None
diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py
index 251cef2..1ddee3f 100755
--- a/gbp/scripts/clone.py
+++ b/gbp/scripts/clone.py
@@ -31,8 +31,7 @@ import gbp.log
def parse_args (argv):
try:
- parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] repository - clone a remote repository')
+ parser = GbpOptionParser(usage='%prog [options] repository - clone a remote repository')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py
index c8c4a36..95a10b0 100644
--- a/gbp/scripts/create_remote_repo.py
+++ b/gbp/scripts/create_remote_repo.py
@@ -245,8 +245,7 @@ def parse_args(argv, sections=[]):
else:
sections = []
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] - '
+ parser = GbpOptionParserDebian(usage='%prog [options] - '
'create a remote repository',
sections=sections)
branch_group = GbpOptionGroup(parser,
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index a848d6d..30c90d1 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -292,8 +292,7 @@ def main(argv):
branch = None
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] paths')
+ parser = GbpOptionParserDebian(usage='%prog [options] paths')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return 1
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 630422b..cbc67f0 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -207,8 +207,7 @@ def set_bare_repo_options(options):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] /path/to/package.dsc')
+ parser = GbpOptionParserDebian(usage='%prog [options] /path/to/package.dsc')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index aae93fa..968aadb 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -183,8 +183,7 @@ def set_bare_repo_options(options):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
+ parser = GbpOptionParserDebian(usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 41d3ddf..5e94126 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -212,8 +212,7 @@ def switch_pq(repo, current):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage="%prog [options] action - maintain patches on a patch queue branch\n"
+ parser = GbpOptionParserDebian(usage="%prog [options] action - maintain patches on a patch queue branch\n"
"Actions:\n"
" export export the patch queue associated to the current branch\n"
" into a quilt patch series in debian/patches/ and update the\n"
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index 03be9fc..6cc47d4 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -70,8 +70,7 @@ def fast_forward_branch(branch, repo, options):
def parse_args(argv):
try:
- parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] - safely update a repository from remote')
+ parser = GbpOptionParser(usage='%prog [options] - safely update a repository from remote')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None