From f317035342050e3aaebda0502f35c051cdb43794 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 24 May 2022 19:20:55 +0200 Subject: [PATCH] Bugfixes for test application & added validators to cli --- src/cpl_cli/live_server/live_server_thread.py | 1 + src/cpl_cli/startup_argument_extension.py | 14 +++++++------- .../custom/general/src/general/application.py | 6 +++--- .../src/general/arguments/generate_argument.py | 3 +-- .../src/general/arguments/install_argument.py | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cpl_cli/live_server/live_server_thread.py b/src/cpl_cli/live_server/live_server_thread.py index ed91165d..8824d2ee 100644 --- a/src/cpl_cli/live_server/live_server_thread.py +++ b/src/cpl_cli/live_server/live_server_thread.py @@ -60,6 +60,7 @@ class LiveServerThread(threading.Thread): Starts the CPL project :return: """ + Console.write_line(self._build_settings.main) main = self._build_settings.main if '.' in self._build_settings.main: length = len(self._build_settings.main.split('.')) - 1 diff --git a/src/cpl_cli/startup_argument_extension.py b/src/cpl_cli/startup_argument_extension.py index 29fc300d..6ec1cd3a 100644 --- a/src/cpl_cli/startup_argument_extension.py +++ b/src/cpl_cli/startup_argument_extension.py @@ -59,7 +59,7 @@ class StartupArgumentExtension(StartupExtensionABC): def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): config.add_json_file('cpl-workspace.json', path=env.working_directory, optional=True, output=False) - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'add', ['a', 'A'], AddService, True) \ + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'add', ['a', 'A'], AddService, True, validators=[WorkspaceValidator]) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) config.create_console_argument(ArgumentTypeEnum.Executable, '', 'build', ['b', 'B'], BuildService, True, validators=[ProjectValidator]) config.create_console_argument(ArgumentTypeEnum.Executable, '', 'generate', ['g', 'G'], GenerateService, True) \ @@ -71,20 +71,20 @@ class StartupArgumentExtension(StartupExtensionABC): .add_console_argument(ArgumentTypeEnum.Variable, '', 'settings', ['st', 'ST'], ' ') \ .add_console_argument(ArgumentTypeEnum.Variable, '', 'thread', ['t', 'T'], ' ') \ .add_console_argument(ArgumentTypeEnum.Variable, '', 'validator', ['v', 'V'], ' ') - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService, True) \ + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService, True, validators=[ProjectValidator]) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \ .add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \ .add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True) - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True) \ + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator]) + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'start', ['s', 'S'], StartService, True) - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'uninstall', ['ui', 'UI'], UninstallService, True) \ + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'start', ['s', 'S'], StartService, True, validators=[ProjectValidator]) + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'uninstall', ['ui', 'UI'], UninstallService, True, validators=[ProjectValidator]) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) - config.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService, True) \ + config.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService, True, validators=[ProjectValidator]) \ .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) config.create_console_argument(ArgumentTypeEnum.Executable, '', 'version', ['v', 'V'], VersionService, True) diff --git a/src/tests/custom/general/src/general/application.py b/src/tests/custom/general/src/general/application.py index c8889159..648ef428 100644 --- a/src/tests/custom/general/src/general/application.py +++ b/src/tests/custom/general/src/general/application.py @@ -1,11 +1,11 @@ import time from typing import Optional -from cpl_core.application import ApplicationABC +from cpl_core.application.application_abc import ApplicationABC from cpl_core.configuration import ConfigurationABC -from cpl_core.console.console import Console +from cpl_core.console import Console from cpl_core.dependency_injection import ServiceProviderABC -from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.logging import LoggerABC from cpl_core.mailing import EMailClientABC, EMail from cpl_core.pipes import IPAddressPipe from test_service import TestService diff --git a/src/tests/custom/general/src/general/arguments/generate_argument.py b/src/tests/custom/general/src/general/arguments/generate_argument.py index c66c7738..1114706b 100644 --- a/src/tests/custom/general/src/general/arguments/generate_argument.py +++ b/src/tests/custom/general/src/general/arguments/generate_argument.py @@ -1,5 +1,4 @@ -from cpl_core.configuration import ConfigurationABC -from cpl_core.configuration.argument_executable_abc import ArgumentExecutableABC +from cpl_core.configuration import ConfigurationABC, ArgumentExecutableABC from cpl_core.console import Console from cpl_core.environment import ApplicationEnvironmentABC diff --git a/src/tests/custom/general/src/general/arguments/install_argument.py b/src/tests/custom/general/src/general/arguments/install_argument.py index ec53cf5a..b99c7bd3 100644 --- a/src/tests/custom/general/src/general/arguments/install_argument.py +++ b/src/tests/custom/general/src/general/arguments/install_argument.py @@ -1,4 +1,4 @@ -from cpl_core.configuration.argument_executable_abc import ArgumentExecutableABC +from cpl_core.configuration import ArgumentExecutableABC from cpl_core.console import Console