Migrated NewService to new argument parsing

This commit is contained in:
Sven Heidemann 2022-05-19 19:52:36 +02:00
parent 44182eec86
commit e7cf545502
14 changed files with 40 additions and 42 deletions

View File

@ -42,7 +42,8 @@ class NewService(CommandABC):
self._build_dict = {} self._build_dict = {}
self._project_json = {} self._project_json = {}
self._command: str = '' self._name: str = ''
self._schematic: ProjectTypeEnum = ProjectTypeEnum.console
self._use_application_api: bool = False self._use_application_api: bool = False
self._use_startup: bool = False self._use_startup: bool = False
self._use_service_providing: bool = False self._use_service_providing: bool = False
@ -111,11 +112,11 @@ class NewService(CommandABC):
def _create_build_settings(self): def _create_build_settings(self):
main = f'{String.convert_to_snake_case(self._project.name)}.main' main = f'{String.convert_to_snake_case(self._project.name)}.main'
if self._command == ProjectTypeEnum.library.value: if self._schematic == ProjectTypeEnum.library.value:
main = f'{String.convert_to_snake_case(self._project.name)}.main' main = f'{String.convert_to_snake_case(self._project.name)}.main'
self._build_dict = { self._build_dict = {
BuildSettingsNameEnum.project_type.value: self._command, BuildSettingsNameEnum.project_type.value: self._schematic,
BuildSettingsNameEnum.source_path.value: '', BuildSettingsNameEnum.source_path.value: '',
BuildSettingsNameEnum.output_path.value: '../../dist', BuildSettingsNameEnum.output_path.value: '../../dist',
BuildSettingsNameEnum.main.value: main, BuildSettingsNameEnum.main.value: main,
@ -191,9 +192,7 @@ class NewService(CommandABC):
:param args: :param args:
:return: :return:
""" """
name = self._config.get_configuration(self._command) self._create_project_settings(self._name)
self._create_project_settings(name)
self._create_build_settings() self._create_build_settings()
self._create_project_json() self._create_project_json()
path = self._get_project_path() path = self._get_project_path()
@ -221,9 +220,7 @@ class NewService(CommandABC):
:param args: :param args:
:return: :return:
""" """
name = self._config.get_configuration(self._command) self._create_project_settings(self._name)
self._create_project_settings(name)
self._create_build_settings() self._create_build_settings()
self._create_project_json() self._create_project_json()
path = self._get_project_path() path = self._get_project_path()
@ -251,15 +248,16 @@ class NewService(CommandABC):
:param args: :param args:
:return: :return:
""" """
if len(args) == 0: console = self._config.get_configuration(ProjectTypeEnum.console.value)
self._help('Usage: cpl new <schematic> [options]') library = self._config.get_configuration(ProjectTypeEnum.library.value)
return if console is not None and library is None:
self._name = console
self._command = str(args[0]).lower() self._schematic = ProjectTypeEnum.console.value
if self._command == ProjectTypeEnum.console.value:
self._console(args) self._console(args)
elif self._command == ProjectTypeEnum.library.value: elif console is None and library is not None:
self._name = library
self._schematic = ProjectTypeEnum.library.value
self._library(args) self._library(args)
else: else:

View File

@ -15,11 +15,11 @@ __title__ = 'cpl_core'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.application'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -28,4 +28,4 @@ from .startup_abc import StartupABC
from .startup_extension_abc import StartupExtensionABC from .startup_extension_abc import StartupExtensionABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -33,4 +33,4 @@ from .flag_argument import FlagArgument
from .variable_argument import VariableArgument from .variable_argument import VariableArgument
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.console'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum
from .spinner_thread import SpinnerThread from .spinner_thread import SpinnerThread
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.database'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings
from .table_abc import TableABC from .table_abc import TableABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection
from .database_connection_abc import DatabaseConnectionABC from .database_connection_abc import DatabaseConnectionABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -24,4 +24,4 @@ from .database_context import DatabaseContext
from .database_context_abc import DatabaseContextABC from .database_context_abc import DatabaseContextABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -30,4 +30,4 @@ from .service_provider import ServiceProvider
from .service_provider_abc import ServiceProviderABC from .service_provider_abc import ServiceProviderABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum
from .application_environment import ApplicationEnvironment from .application_environment import ApplicationEnvironment
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings
from .logging_settings_name_enum import LoggingSettingsNameEnum from .logging_settings_name_enum import LoggingSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings
from .email_client_settings_name_enum import EMailClientSettingsNameEnum from .email_client_settings_name_enum import EMailClientSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.time'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')

View File

@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.3.dev2' __version__ = '2022.6.3.dev1'
from collections import namedtuple from collections import namedtuple
@ -25,4 +25,4 @@ from .string import String
from .pip import Pip from .pip import Pip
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='3.dev2') version_info = VersionInfo(major='2022', minor='6', micro='3.dev1')