aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-02-26 11:44:36 +0100
committerGuido Günther <agx@sigxcpu.org>2009-02-26 13:48:29 +0100
commite3b76103f7e0e238341303e5941e867278594948 (patch)
tree12f761deda1cfbbe3d853905b325b9642bc044cd /gbp
parent660acbe28b4f52f68ae467eb5812897236e8d6e6 (diff)
simplify boolean option handling
Diffstat (limited to 'gbp')
-rw-r--r--gbp/config.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/gbp/config.py b/gbp/config.py
index cbacc9cb..9ef668af 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -60,8 +60,6 @@ class GbpOptionParser(OptionParser):
"format string for upstream tags, default is '%(upstream-tag)s'",
'sign-tags':
"sign tags, default is '%(sign-tags)s'",
- 'no-sign-tags':
- "negates sign-tags",
'keyid':
"GPG keyid to sign tags with, default is '%(keyid)s'",
'pristine-tar':
@@ -70,8 +68,6 @@ class GbpOptionParser(OptionParser):
"files to filter out during import (can be given multiple times)",
'git-author':
"use name and email from git-config for changelog trailer, default is '%(git-author)s'",
- 'no-git-author':
- "negates git-author",
}
config_files = [ '/etc/git-buildpackage/gbp.conf',
os.path.expanduser('~/.gbp.conf'),
@@ -159,6 +155,11 @@ class GbpOptionParser(OptionParser):
default=self.get_default(option_name, **kwargs),
help=help % self.config, **kwargs)
+ def add_boolean_config_file_option(self, option_name, dest):
+ self.add_config_file_option(option_name=option_name, dest=dest, action="store_true")
+ neg_help = "negates '--%s%s'" % (self.prefix, option_name)
+ self.add_config_file_option(option_name="no-%s" % option_name, dest=dest, help=neg_help, action="store_false")
+
class GbpOptionGroup(OptionGroup):
def add_config_file_option(self, option_name, dest, help=None, **kwargs):
"""
@@ -176,4 +177,9 @@ class GbpOptionGroup(OptionGroup):
default=self.parser.get_default(option_name, **kwargs),
help=help % self.parser.config, **kwargs)
+ def add_boolean_config_file_option(self, option_name, dest):
+ self.add_config_file_option(option_name=option_name, dest=dest, action="store_true")
+ neg_help = "negates '--%s%s'" % (self.parser.prefix, option_name)
+ self.add_config_file_option(option_name="no-%s" % option_name, dest=dest, help=neg_help, action="store_false")
+
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: