summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorErovia <erovia@users.noreply.github.com>2020-01-12 14:56:11 +0100
committerskullydazed <skullydazed@users.noreply.github.com>2020-01-19 21:29:36 -0800
commit1f86e8ae9ac5035c7dd359880b4534f5145a215f (patch)
tree9609a8cbb2b5b37100051474317b85560776093e /lib/python
parente7f6e90a22306903fd38a39c95639776a9e07b5b (diff)
Fix attribute heritance for long commands.
This is needed for inheritance to work with commands that have dashes in their names.
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/milc.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/python/milc.py b/lib/python/milc.py
index bc08a87b6d..36072ca764 100644
--- a/lib/python/milc.py
+++ b/lib/python/milc.py
@@ -511,7 +511,10 @@ class MILC(object):
if argument not in self.arg_only:
# Find the argument's section
- if self._entrypoint.__name__ in self.default_arguments and argument in self.default_arguments[self._entrypoint.__name__]:
+ # Underscores in command's names are converted to dashes during initialization.
+ # TODO(Erovia) Find a better solution
+ entrypoint_name = self._entrypoint.__name__.replace("_", "-")
+ if entrypoint_name in self.default_arguments and argument in self.default_arguments[entrypoint_name]:
argument_found = True
section = self._entrypoint.__name__
if argument in self.default_arguments['general']:
@@ -523,12 +526,12 @@ class MILC(object):
exit(1)
# Merge this argument into self.config
- if argument in self.default_arguments[section]:
+ if argument in self.default_arguments['general'] or argument in self.default_arguments[entrypoint_name]:
arg_value = getattr(self.args, argument)
- if arg_value:
+ if arg_value is not None:
self.config[section][argument] = arg_value
else:
- if argument not in self.config[section]:
+ if argument not in self.config[entrypoint_name]:
# Check if the argument exist for this section
arg = getattr(self.args, argument)
if arg is not None: