From 8a95c03038565d4d5445022115ffb2e4ddd96698 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 12 Mar 2021 15:44:55 +0100 Subject: [PATCH] Bugfixes --- src/cpl/configuration/configuration.py | 2 +- src/cpl_cli/command/generate.py | 18 +++++++++--------- src/cpl_cli/startup.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cpl/configuration/configuration.py b/src/cpl/configuration/configuration.py index 7270a21b..824f3d63 100644 --- a/src/cpl/configuration/configuration.py +++ b/src/cpl/configuration/configuration.py @@ -219,7 +219,7 @@ class Configuration(ConfigurationABC): config_from_file = self._load_json_file(file_path, output) for sub in ConfigurationModelABC.__subclasses__(): 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.from_dict(value) self.add_configuration(sub, configuration) diff --git a/src/cpl_cli/command/generate.py b/src/cpl_cli/command/generate.py index c5e355ea..20a109ce 100644 --- a/src/cpl_cli/command/generate.py +++ b/src/cpl_cli/command/generate.py @@ -29,10 +29,6 @@ class Generate(CommandABC): "Upper": "Class", "Template": ClassTemplate }, - "configmodel": { - "Upper": "Settings", - "Template": ConfigModelTemplate - }, "enum": { "Upper": "Enum", "Template": EnumTemplate @@ -40,6 +36,10 @@ class Generate(CommandABC): "service": { "Upper": "Service", "Template": ServiceTemplate + }, + "settings": { + "Upper": "Settings", + "Template": ConfigModelTemplate } } @@ -51,11 +51,11 @@ class Generate(CommandABC): Console.error(message) schematics = [ - ['abc (a|A)'], - ['class (c|C)'], - ['configmodel (cm|CM)'], - ['enum (e|E)'], - ['service (s|S)'], + 'abc (a|A)', + 'class (c|C)', + 'enum (e|E)', + 'service (s|S)', + 'settings (st|ST)' ] Console.write_line('Available Schematics:') for name in schematics: diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py index e2f8d5cd..ce4f4125 100644 --- a/src/cpl_cli/startup.py +++ b/src/cpl_cli/startup.py @@ -46,9 +46,9 @@ class Startup(StartupABC): self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', [ ConsoleArgument('', 'abc', ['a', 'A'], ' '), ConsoleArgument('', 'class', ['c', 'C'], ' '), - ConsoleArgument('', 'configmodel', ['cm', 'CM'], ' '), 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('', 'new', ['n', 'N'], '', [