diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/python/milc.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/python/milc.py b/lib/python/milc.py index bc08a87b6..36072ca76 100644 --- a/lib/python/milc.py +++ b/lib/python/milc.py | |||
| @@ -511,7 +511,10 @@ class MILC(object): | |||
| 511 | 511 | ||
| 512 | if argument not in self.arg_only: | 512 | if argument not in self.arg_only: |
| 513 | # Find the argument's section | 513 | # Find the argument's section |
| 514 | if self._entrypoint.__name__ in self.default_arguments and argument in self.default_arguments[self._entrypoint.__name__]: | 514 | # Underscores in command's names are converted to dashes during initialization. |
| 515 | # TODO(Erovia) Find a better solution | ||
| 516 | entrypoint_name = self._entrypoint.__name__.replace("_", "-") | ||
| 517 | if entrypoint_name in self.default_arguments and argument in self.default_arguments[entrypoint_name]: | ||
| 515 | argument_found = True | 518 | argument_found = True |
| 516 | section = self._entrypoint.__name__ | 519 | section = self._entrypoint.__name__ |
| 517 | if argument in self.default_arguments['general']: | 520 | if argument in self.default_arguments['general']: |
| @@ -523,12 +526,12 @@ class MILC(object): | |||
| 523 | exit(1) | 526 | exit(1) |
| 524 | 527 | ||
| 525 | # Merge this argument into self.config | 528 | # Merge this argument into self.config |
| 526 | if argument in self.default_arguments[section]: | 529 | if argument in self.default_arguments['general'] or argument in self.default_arguments[entrypoint_name]: |
| 527 | arg_value = getattr(self.args, argument) | 530 | arg_value = getattr(self.args, argument) |
| 528 | if arg_value: | 531 | if arg_value is not None: |
| 529 | self.config[section][argument] = arg_value | 532 | self.config[section][argument] = arg_value |
| 530 | else: | 533 | else: |
| 531 | if argument not in self.config[section]: | 534 | if argument not in self.config[entrypoint_name]: |
| 532 | # Check if the argument exist for this section | 535 | # Check if the argument exist for this section |
| 533 | arg = getattr(self.args, argument) | 536 | arg = getattr(self.args, argument) |
| 534 | if arg is not None: | 537 | if arg is not None: |
