aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts/pull.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-04-02 22:13:46 +0200
committerGuido Günther <agx@sigxcpu.org>2014-04-03 20:34:07 +0200
commit459d9bfcce481b0da71e9493e644488c83e0e9ba (patch)
tree4fa6b653354cba87f5da0953b151d54af474a5bb /gbp/scripts/pull.py
parentb393080ac3b98342b53849d14049db024183f0cb (diff)
config: add decorator to add_option_* functions
This allows us to build an internal list of valid options and print these.
Diffstat (limited to 'gbp/scripts/pull.py')
-rwxr-xr-xgbp/scripts/pull.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index 03be9fc7..fb0d8271 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -68,13 +68,14 @@ def fast_forward_branch(branch, repo, options):
msg="gbp: forward %s to %s" % (branch, remote))
return update
-def parse_args(argv):
+
+def build_parser(name):
try:
- parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
+ parser = GbpOptionParser(command=os.path.basename(name), prefix='',
usage='%prog [options] - safely update a repository from remote')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
- return None, None
+ return None
branch_group = GbpOptionGroup(parser, "branch options", "branch update and layout options")
parser.add_option_group(branch_group)
@@ -93,6 +94,13 @@ def parse_args(argv):
parser.add_config_file_option(option_name="color", dest="color", type='tristate')
parser.add_config_file_option(option_name="color-scheme",
dest="color_scheme")
+ return parser
+
+
+def parse_args(argv):
+ parser = build_parser(argv[0])
+ if not parser:
+ return None, None
return parser.parse_args(argv)