This commit is contained in:
Sven Heidemann 2021-03-12 15:44:55 +01:00
parent 650f632c17
commit 8a95c03038
3 changed files with 12 additions and 12 deletions

View File

@ -219,7 +219,7 @@ class Configuration(ConfigurationABC):
config_from_file = self._load_json_file(file_path, output) config_from_file = self._load_json_file(file_path, output)
for sub in ConfigurationModelABC.__subclasses__(): for sub in ConfigurationModelABC.__subclasses__():
for key, value in config_from_file.items(): for key, value in config_from_file.items():
if sub.__name__ == key: if sub.__name__ == key or sub.__name__.replace('Settings', '') == key:
configuration = sub() configuration = sub()
configuration.from_dict(value) configuration.from_dict(value)
self.add_configuration(sub, configuration) self.add_configuration(sub, configuration)

View File

@ -29,10 +29,6 @@ class Generate(CommandABC):
"Upper": "Class", "Upper": "Class",
"Template": ClassTemplate "Template": ClassTemplate
}, },
"configmodel": {
"Upper": "Settings",
"Template": ConfigModelTemplate
},
"enum": { "enum": {
"Upper": "Enum", "Upper": "Enum",
"Template": EnumTemplate "Template": EnumTemplate
@ -40,6 +36,10 @@ class Generate(CommandABC):
"service": { "service": {
"Upper": "Service", "Upper": "Service",
"Template": ServiceTemplate "Template": ServiceTemplate
},
"settings": {
"Upper": "Settings",
"Template": ConfigModelTemplate
} }
} }
@ -51,11 +51,11 @@ class Generate(CommandABC):
Console.error(message) Console.error(message)
schematics = [ schematics = [
['abc (a|A)'], 'abc (a|A)',
['class (c|C)'], 'class (c|C)',
['configmodel (cm|CM)'], 'enum (e|E)',
['enum (e|E)'], 'service (s|S)',
['service (s|S)'], 'settings (st|ST)'
] ]
Console.write_line('Available Schematics:') Console.write_line('Available Schematics:')
for name in schematics: for name in schematics:

View File

@ -46,9 +46,9 @@ class Startup(StartupABC):
self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', [ self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', [
ConsoleArgument('', 'abc', ['a', 'A'], ' '), ConsoleArgument('', 'abc', ['a', 'A'], ' '),
ConsoleArgument('', 'class', ['c', 'C'], ' '), ConsoleArgument('', 'class', ['c', 'C'], ' '),
ConsoleArgument('', 'configmodel', ['cm', 'CM'], ' '),
ConsoleArgument('', 'enum', ['e', 'E'], ' '), ConsoleArgument('', 'enum', ['e', 'E'], ' '),
ConsoleArgument('', 'service', ['s', 'S'], ' ') ConsoleArgument('', 'service', ['s', 'S'], ' '),
ConsoleArgument('', 'settings', ['st', 'ST'], ' ')
])) ]))
self._configuration.add_console_argument(ConsoleArgument('', 'help', ['h', 'H'], '')) self._configuration.add_console_argument(ConsoleArgument('', 'help', ['h', 'H'], ''))
self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', [ self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', [