Created
September 24, 2024 04:12
-
-
Save tsibley/e08cb4ab534a757637b567f69f86cbb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cram/_main.py b/cram/_main.py | |
index 11d457b..cdbf8db 100644 | |
--- a/cram/_main.py | |
+++ b/cram/_main.py | |
@@ -42,14 +42,14 @@ class _OptionParser(optparse.OptionParser): | |
option = optparse.OptionParser.add_option(self, *args, **kwargs) | |
if option.dest and option.dest != 'version': | |
key = option.dest.replace('_', '-') | |
- self._config_opts[key] = option.action == 'store_true' | |
+ self._config_opts[key] = (option.dest, option.action == 'store_true') | |
return option | |
def parse_args(self, args=None, values=None): | |
config = configparser.RawConfigParser() | |
config.read(_expandpath(os.environ.get('CRAMRC', '.cramrc'))) | |
defaults = {} | |
- for key, isbool in self._config_opts.items(): | |
+ for key, (dest, isbool) in self._config_opts.items(): | |
try: | |
if isbool: | |
try: | |
@@ -63,7 +63,7 @@ class _OptionParser(optparse.OptionParser): | |
except (configparser.NoSectionError, configparser.NoOptionError): | |
pass | |
else: | |
- defaults[key] = value | |
+ defaults[dest] = value | |
self.set_defaults(**defaults) | |
eargs = os.environ.get('CRAM', '').strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment