diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-05-20 11:28:51 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:22:04 +0200 |
commit | d0e102fed98fa8a02ba906d54d0acf4873018cc8 (patch) | |
tree | ad4adb053731c8818612ed428b0c596ba2e979a0 /gbp/config.py | |
parent | 60c7b7d23e8ec44fd82f700034305041668d5e6d (diff) | |
download | git-buildpackage-d0e102fed98fa8a02ba906d54d0acf4873018cc8.tar.gz git-buildpackage-d0e102fed98fa8a02ba906d54d0acf4873018cc8.tar.bz2 git-buildpackage-d0e102fed98fa8a02ba906d54d0acf4873018cc8.zip |
GbpOptionParser: allow using the default 'dest' attribute
Make it possible to add options without explicitly defining the 'dest'
attribute - in which case the default of OptionParser is used.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/config.py')
-rw-r--r-- | gbp/config.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gbp/config.py b/gbp/config.py index 63c11cbd..75d35fe5 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -462,23 +462,21 @@ class GbpOptionParser(OptionParser): return default @safe_option - def add_config_file_option(self, option_name, dest, help=None, **kwargs): + def add_config_file_option(self, option_name, help=None, **kwargs): """ set a option for the command line parser, the default is read from the config file param option_name: name of the option type option_name: string - param dest: where to store this option - type dest: string param help: help text type help: string """ if not help: help = self.help[option_name] - OptionParser.add_option(self, "--%s%s" % (self.prefix, option_name), dest=dest, + OptionParser.add_option(self, "--%s%s" % (self.prefix, option_name), default=self.get_default(option_name, **kwargs), help=help % self.config, **kwargs) - def add_boolean_config_file_option(self, option_name, dest): + def add_boolean_config_file_option(self, option_name, dest=None): 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") |