diff options
author | Erovia <erovia@users.noreply.github.com> | 2020-01-12 14:56:11 +0100 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2020-01-19 21:29:36 -0800 |
commit | 1f86e8ae9ac5035c7dd359880b4534f5145a215f (patch) | |
tree | 9609a8cbb2b5b37100051474317b85560776093e | |
parent | e7f6e90a22306903fd38a39c95639776a9e07b5b (diff) | |
download | qmk_firmware-1f86e8ae9ac5035c7dd359880b4534f5145a215f.tar.gz qmk_firmware-1f86e8ae9ac5035c7dd359880b4534f5145a215f.zip |
Fix attribute heritance for long commands.
This is needed for inheritance to work with commands that have dashes in
their names.
-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: |