diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-03-27 21:22:25 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-03-27 21:22:25 +0100 |
commit | e1780f0e457e9dbdba6d6f1b0c5cb3e4780cf7f7 (patch) | |
tree | d349a6098c5764d3a879fc705a011adc09e3f7c1 | |
parent | bbf21bf366ff0d248f9c06b1cff600f339b8655e (diff) | |
download | git-buildpackage-e1780f0e457e9dbdba6d6f1b0c5cb3e4780cf7f7.tar.gz git-buildpackage-e1780f0e457e9dbdba6d6f1b0c5cb3e4780cf7f7.tar.bz2 git-buildpackage-e1780f0e457e9dbdba6d6f1b0c5cb3e4780cf7f7.zip |
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.py | 8 | ||||
-rwxr-xr-x | gbp/scripts/buildpackage.py | 2 | ||||
-rwxr-xr-x | gbp/scripts/clone.py | 3 | ||||
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 3 | ||||
-rw-r--r-- | gbp/scripts/dch.py | 3 | ||||
-rw-r--r-- | gbp/scripts/import_dsc.py | 3 | ||||
-rw-r--r-- | gbp/scripts/import_orig.py | 3 | ||||
-rwxr-xr-x | gbp/scripts/pq.py | 3 | ||||
-rwxr-xr-x | gbp/scripts/pull.py | 3 |
9 files changed, 15 insertions, 16 deletions
diff --git a/gbp/config.py b/gbp/config.py index fa6e6798..9ac1ee8f 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 753ad64a..0b14b3f6 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 251cef21..1ddee3fb 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 c8c4a36a..95a10b00 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 a848d6d2..30c90d16 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 630422bf..cbc67f0f 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 aae93fab..968aadb1 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 41d3ddf8..5e941262 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 03be9fc7..6cc47d4c 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 |