2022.6 #88

Merged
edraft merged 158 commits from 2022.6 into master 2022-06-29 17:50:07 +02:00
13 changed files with 191 additions and 161 deletions
Showing only changes of commit 8ebd4864d3 - Show all commits

View File

@ -33,32 +33,33 @@ class CLI(ApplicationABC):
""" """
ApplicationABC.__init__(self, config, services) ApplicationABC.__init__(self, config, services)
self._command_handler: Optional[CommandHandler] = None # self._command_handler: Optional[CommandHandler] = None
self._options: list[str] = [] self._options: list[str] = []
def configure(self): def configure(self):
self._command_handler: CommandHandler = self._services.get_service(CommandHandler) pass
# self._command_handler: CommandHandler = self._services.get_service(CommandHandler)
self._command_handler.add_command(CommandModel('add', ['a', 'a'], AddService, False, False, False)) #
self._command_handler.add_command(CommandModel('build', ['b', 'B'], BuildService, False, True, True)) # self._command_handler.add_command(CommandModel('add', ['a', 'a'], AddService, False, False, False))
self._command_handler.add_command(CommandModel('generate', ['g', 'G'], GenerateService, False, True, False)) # self._command_handler.add_command(CommandModel('build', ['b', 'B'], BuildService, False, True, True))
self._command_handler.add_command(CommandModel('help', ['h', 'H'], HelpService, False, False, False)) # self._command_handler.add_command(CommandModel('generate', ['g', 'G'], GenerateService, False, True, False))
self._command_handler.add_command(CommandModel('install', ['i', 'I'], InstallService, False, True, True)) # self._command_handler.add_command(CommandModel('help', ['h', 'H'], HelpService, False, False, False))
self._command_handler.add_command(CommandModel('new', ['n', 'N'], NewService, False, False, True)) # self._command_handler.add_command(CommandModel('install', ['i', 'I'], InstallService, False, True, True))
self._command_handler.add_command(CommandModel('publish', ['p', 'P'], PublishService, False, True, True)) # self._command_handler.add_command(CommandModel('new', ['n', 'N'], NewService, False, False, True))
self._command_handler.add_command(CommandModel('remove', ['r', 'R'], RemoveService, True, True, False)) # self._command_handler.add_command(CommandModel('publish', ['p', 'P'], PublishService, False, True, True))
self._command_handler.add_command(CommandModel('start', ['s', 'S'], StartService, False, True, True)) # self._command_handler.add_command(CommandModel('remove', ['r', 'R'], RemoveService, True, True, False))
self._command_handler.add_command(CommandModel('uninstall', ['ui', 'UI'], UninstallService, False, True, True)) # self._command_handler.add_command(CommandModel('start', ['s', 'S'], StartService, False, True, True))
self._command_handler.add_command(CommandModel('update', ['u', 'U'], UpdateService, False, True, True)) # self._command_handler.add_command(CommandModel('uninstall', ['ui', 'UI'], UninstallService, False, True, True))
self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False, False, False)) # self._command_handler.add_command(CommandModel('update', ['u', 'U'], UpdateService, False, True, True))
# self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False, False, False))
if os.path.isfile(os.path.join(self._environment.working_directory, 'cpl-workspace.json')): #
workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings) # if os.path.isfile(os.path.join(self._environment.working_directory, 'cpl-workspace.json')):
for script in workspace.scripts: # workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings)
self._command_handler.add_command(CommandModel(script, [], CustomScriptService, True, True, False)) # for script in workspace.scripts:
# self._command_handler.add_command(CommandModel(script, [], CustomScriptService, True, True, False))
self._command_handler.add_command(CommandModel('--help', ['-h', '-H'], HelpService, False, False, False)) #
self._options.append('--help') # self._command_handler.add_command(CommandModel('--help', ['-h', '-H'], HelpService, False, False, False))
# self._options.append('--help')
def main(self): def main(self):
""" """
@ -66,61 +67,62 @@ class CLI(ApplicationABC):
:return: :return:
""" """
try: try:
command = None pass
args = [] # command = None
if len(self._configuration.additional_arguments) > 0: # args = []
is_option = False # if len(self._configuration.additional_arguments) > 0:
for opt in self._options: # is_option = False
if opt in self._configuration.additional_arguments: # for opt in self._options:
is_option = True # if opt in self._configuration.additional_arguments:
command = opt # is_option = True
args = self._configuration.additional_arguments # command = opt
args.remove(opt) # args = self._configuration.additional_arguments
# args.remove(opt)
if not is_option: #
command = self._configuration.additional_arguments[0] # if not is_option:
if len(self._configuration.additional_arguments) > 1: # command = self._configuration.additional_arguments[0]
args = self._configuration.additional_arguments[1:] # if len(self._configuration.additional_arguments) > 1:
else: # args = self._configuration.additional_arguments[1:]
for cmd in self._command_handler.commands: # else:
result = self._configuration.get_configuration(cmd.name) # for cmd in self._command_handler.commands:
result_args: list[str] = self._configuration.get_configuration(f'{cmd.name}AdditionalArguments') # result = self._configuration.get_configuration(cmd.name)
is_option = False # result_args: list[str] = self._configuration.get_configuration(f'{cmd.name}AdditionalArguments')
if result is None: # is_option = False
continue # if result is None:
# continue
for opt in self._options: #
if opt == result: # for opt in self._options:
is_option = True # if opt == result:
command = opt # is_option = True
# command = opt
elif result_args is not None and opt in result_args: #
is_option = True # elif result_args is not None and opt in result_args:
command = opt # is_option = True
result_args.remove(opt) # command = opt
# result_args.remove(opt)
if is_option: #
args.append(cmd.name) # if is_option:
if result_args is not None: # args.append(cmd.name)
for arg in result_args: # if result_args is not None:
args.append(arg) # for arg in result_args:
# args.append(arg)
elif result is not None: #
command = cmd.name # elif result is not None:
args.append(result) # command = cmd.name
# args.append(result)
for arg in result_args: #
args.append(arg) # for arg in result_args:
# args.append(arg)
else: #
Error.error(f'Unexpected command') # else:
return # Error.error(f'Unexpected command')
# return
if command is None: #
Error.error(f'Expected command') # if command is None:
return # Error.error(f'Expected command')
# return
self._command_handler.handle(command, args) #
# self._command_handler.handle(command, args)
except KeyboardInterrupt: except KeyboardInterrupt:
Console.write_line() Console.write_line()
sys.exit() sys.exit()

View File

@ -22,7 +22,6 @@ class AddService(CommandABC):
CommandABC.__init__(self) CommandABC.__init__(self)
self._config = config self._config = config
self._workspace = workspace self._workspace = workspace
@property @property
@ -104,15 +103,15 @@ class AddService(CommandABC):
Console.error(f'Invalid target: {target}') Console.error(f'Invalid target: {target}')
return return
if target in build_settings.project_references:
Console.error(f'Project reference already exists.')
return
if self._workspace is None: if self._workspace is None:
target = f'../{target}' target = f'../{target}'
else: else:
target = target.replace('src', '..') target = target.replace('src', '..')
if target in build_settings.project_references:
Console.error(f'Project reference already exists.')
return
build_settings.project_references.append(target) build_settings.project_references.append(target)
Console.spinner( Console.spinner(

View File

@ -70,7 +70,6 @@ class RemoveService(CommandABC):
:param args: :param args:
:return: :return:
""" """
project_name = args[0] project_name = args[0]
if project_name not in self._workspace.projects: if project_name not in self._workspace.projects:
Console.error(f'Project {project_name} not found in workspace.') Console.error(f'Project {project_name} not found in workspace.')

View File

@ -1,7 +1,9 @@
from abc import abstractmethod, ABC from abc import abstractmethod, ABC
from cpl_core.configuration.executable_argument import ExecutableArgument
class CommandABC(ABC):
class CommandABC(ExecutableArgument):
@abstractmethod @abstractmethod
def __init__(self): def __init__(self):
@ -10,6 +12,3 @@ class CommandABC(ABC):
@property @property
@abstractmethod @abstractmethod
def help_message(self) -> str: pass def help_message(self) -> str: pass
@abstractmethod
def run(self, args: list[str]): pass

View File

@ -42,6 +42,8 @@
"*.json" "*.json"
] ]
}, },
"ProjectReferences": [] "ProjectReferences": [
"../cpl_core/cpl_core.json"
]
} }
} }

View File

@ -2,8 +2,9 @@ import os
from typing import Optional from typing import Optional
from cpl_core.application.startup_abc import StartupABC from cpl_core.application.startup_abc import StartupABC
from cpl_core.configuration.argument_abc import ConsoleArgument from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.configuration.configuration_abc import ConfigurationABC
from cpl_core.console import Console
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
from cpl_cli.command.add_service import AddService from cpl_cli.command.add_service import AddService
@ -40,52 +41,48 @@ class Startup(StartupABC):
configuration.add_environment_variables('PYTHON_') configuration.add_environment_variables('PYTHON_')
configuration.add_environment_variables('CPL_') configuration.add_environment_variables('CPL_')
configuration.add_json_file('appsettings.json', path=environment.runtime_directory, optional=False, output=False) configuration.add_json_file('appsettings.json', path=environment.runtime_directory, optional=False, output=False)
configuration.add_json_file('cpl-workspace.json', path=environment.working_directory, optional=True, output=False)
configuration.add_console_argument(ConsoleArgument('', 'add', ['a', 'a'], ' ')) configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'add', ['a', 'A'], AddService) \
configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], '')) .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[ configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'build', ['b', 'B'], BuildService)
ConsoleArgument('', 'abc', ['a', 'A'], ' '), configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'generate', ['g', 'G'], GenerateService) \
ConsoleArgument('', 'class', ['c', 'C'], ' '), .add_console_argument(ArgumentTypeEnum.Variable, '', 'abc', ['a', 'A'], ' ') \
ConsoleArgument('', 'enum', ['e', 'E'], ' '), .add_console_argument(ArgumentTypeEnum.Variable, '', 'class', ['c', 'C'], ' ') \
ConsoleArgument('', 'service', ['s', 'S'], ' '), .add_console_argument(ArgumentTypeEnum.Variable, '', 'enum', ['e', 'E'], ' ') \
ConsoleArgument('', 'settings', ['st', 'ST'], ' '), .add_console_argument(ArgumentTypeEnum.Variable, '', 'service', ['s', 'S'], ' ') \
ConsoleArgument('', 'thread', ['t', 't'], ' ') .add_console_argument(ArgumentTypeEnum.Variable, '', 'settings', ['st', 'ST'], ' ') \
])) .add_console_argument(ArgumentTypeEnum.Variable, '', 'thread', ['t', 't'], ' ')
configuration.add_console_argument( configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService) \
ConsoleArgument('', 'help', ['h', 'H'], ' ', is_value_token_optional=True) .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService) \
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ')
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService)
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'start', ['S', 'S'], StartService)
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'uninstall', ['ui', 'UI'], UninstallService) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService)
configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'version', ['v', 'V'], VersionService)
configuration.for_each_argument(
lambda a: a.add_console_argument(ArgumentTypeEnum.Executable, '--', 'help', ['h', 'H'], HelpService)
) )
configuration.add_console_argument( configuration.create_console_argument(ArgumentTypeEnum.Executable, '', 'help', ['h', 'H'], HelpService)
ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True, console_arguments= [
ConsoleArgument('', '--virtual', ['--v', '--V'], ''),
ConsoleArgument('', '--simulate', ['--s', '--S'], ''),
])
)
configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[
ConsoleArgument('', 'console', ['c', 'C'], ' '),
ConsoleArgument('', 'library', ['l', 'L'], ' ')
]))
configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], ''))
configuration.add_console_argument(ConsoleArgument('', 'remove', ['r', 'R'], ' '))
configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], ''))
configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' '))
configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], ''))
configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], ''))
configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], '')) workspace: Optional[WorkspaceSettings] = configuration.get_configuration(WorkspaceSettings)
if workspace is not None:
if os.path.isfile(os.path.join(environment.working_directory, 'cpl-workspace.json')):
configuration.add_json_file('cpl-workspace.json', optional=True, output=False)
workspace: Optional[WorkspaceSettings] = configuration.get_configuration(WorkspaceSettings)
for script in workspace.scripts: for script in workspace.scripts:
configuration.add_console_argument( configuration.create_console_argument(ArgumentTypeEnum.Executable, '', script, [], CustomScriptService)
ConsoleArgument('', script, [], ' ', is_value_token_optional=True))
configuration.parse_console_arguments(error=False)
return configuration return configuration
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
services.add_singleton(CommandHandler) # services.add_singleton(CommandHandler)
services.add_transient(PublisherABC, PublisherService) services.add_transient(PublisherABC, PublisherService)
services.add_transient(LiveServerService) services.add_transient(LiveServerService)

View File

@ -23,6 +23,7 @@ from collections import namedtuple
from .application_abc import ApplicationABC from .application_abc import ApplicationABC
from .application_builder import ApplicationBuilder from .application_builder import ApplicationBuilder
from .application_builder_abc import ApplicationBuilderABC from .application_builder_abc import ApplicationBuilderABC
from .application_extension_abc import ApplicationExtensionABC
from .startup_abc import StartupABC from .startup_abc import StartupABC
from .startup_extension_abc import StartupExtensionABC from .startup_extension_abc import StartupExtensionABC

View File

@ -55,7 +55,7 @@ class ApplicationBuilder(ApplicationBuilderABC):
config = self._configuration config = self._configuration
services = self._services.build_service_provider() services = self._services.build_service_provider()
config.resolve_runnable_argument_types(services) config.resolve_runnable_argument_types(services)
config.parse_console_arguments(error=False) config.parse_console_arguments()
for ex in self._app_extensions: for ex in self._app_extensions:
extension = ex() extension = ex()

View File

@ -20,11 +20,17 @@ __version__ = '2022.6.3.dev2'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .argument_abc import ArgumentABC
from .argument_builder import ArgumentBuilder
from .argument_executable_abc import ArgumentExecutableABC
from .argument_type_enum import ArgumentTypeEnum
from .configuration import Configuration from .configuration import Configuration
from .configuration_abc import ConfigurationABC from .configuration_abc import ConfigurationABC
from .configuration_model_abc import ConfigurationModelABC from .configuration_model_abc import ConfigurationModelABC
from .configuration_variable_name_enum import ConfigurationVariableNameEnum from .configuration_variable_name_enum import ConfigurationVariableNameEnum
from .argument_abc import ArgumentABC from .executable_argument import ExecutableArgument
from .flag_argument import FlagArgument
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.dev2')

View File

@ -147,15 +147,6 @@ class Configuration(ConfigurationABC):
self._print_error(__name__, f'Cannot load config file: {file}! -> {e}') self._print_error(__name__, f'Cannot load config file: {file}! -> {e}')
return {} return {}
def add_environment_variables(self, prefix: str):
for variable in ConfigurationVariableNameEnum.to_list():
var_name = f'{prefix}{variable}'
if var_name in [key.upper() for key in os.environ.keys()]:
self._set_variable(variable, os.environ[var_name])
def add_console_argument(self, argument: ArgumentABC):
self._argument_types.append(argument)
def _parse_arguments(self, call_stack: list[Callable], arg_list: list[str], args_types: list[ArgumentABC]): def _parse_arguments(self, call_stack: list[Callable], arg_list: list[str], args_types: list[ArgumentABC]):
for i in range(0, len(arg_list)): for i in range(0, len(arg_list)):
arg_str = arg_list[i] arg_str = arg_list[i]
@ -169,7 +160,8 @@ class Configuration(ConfigurationABC):
if arg_str.startswith(arg.token) \ if arg_str.startswith(arg.token) \
and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases: and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases:
call_stack.append(arg.run) call_stack.append(arg.run)
self._parse_arguments(call_stack, arg_list[i:], arg.console_arguments) self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments)
break
# variables # variables
elif isinstance(arg, VariableArgument): elif isinstance(arg, VariableArgument):
@ -185,24 +177,28 @@ class Configuration(ConfigurationABC):
value = arg_list[i + 1] value = arg_list[i + 1]
self._set_variable(arg.name, value) self._set_variable(arg.name, value)
self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments) self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments)
break
# flags # flags
elif isinstance(arg, FlagArgument): elif isinstance(arg, FlagArgument):
if arg_str.startswith(arg.token) \ if arg_str.startswith(arg.token) \
and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases: and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases:
self._additional_arguments.append(arg.name) self._additional_arguments.append(arg.name)
self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments) self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments)
break
def parse_console_arguments(self, error: bool = None): # add left over values to args
# sets environment variables as possible arguments as: --VAR=VALUE if arg_str not in self._additional_arguments:
for arg_name in ConfigurationVariableNameEnum.to_list(): self._additional_arguments.append(arg_str)
self.add_console_argument(VariableArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '='))
arg_list = sys.argv[1:] def add_environment_variables(self, prefix: str):
call_stack = [] for variable in ConfigurationVariableNameEnum.to_list():
self._parse_arguments(call_stack, arg_list, self._argument_types) var_name = f'{prefix}{variable}'
if var_name in [key.upper() for key in os.environ.keys()]:
self._set_variable(variable, os.environ[var_name])
for call in call_stack: def add_console_argument(self, argument: ArgumentABC):
call(self._additional_arguments) self._argument_types.append(argument)
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None): def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
if os.path.isabs(name): if os.path.isabs(name):
@ -246,6 +242,10 @@ class Configuration(ConfigurationABC):
self._argument_types.append(argument) self._argument_types.append(argument)
return argument return argument
def for_each_argument(self, call: Callable):
for arg in self._argument_types:
call(arg)
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> \ def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> \
Optional[Union[str, ConfigurationModelABC]]: Optional[Union[str, ConfigurationModelABC]]:
if type(search_type) is str: if type(search_type) is str:
@ -265,6 +265,18 @@ class Configuration(ConfigurationABC):
if config_model == search_type: if config_model == search_type:
return self._config[config_model] return self._config[config_model]
def parse_console_arguments(self, error: bool = None):
# sets environment variables as possible arguments as: --VAR=VALUE
for arg_name in ConfigurationVariableNameEnum.to_list():
self.add_console_argument(VariableArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '='))
arg_list = sys.argv[1:]
call_stack = []
self._parse_arguments(call_stack, arg_list, self._argument_types)
for call in call_stack:
call(self._additional_arguments)
def resolve_runnable_argument_types(self, services: ServiceProviderABC): def resolve_runnable_argument_types(self, services: ServiceProviderABC):
for arg in self._argument_types: for arg in self._argument_types:
if isinstance(arg, ExecutableArgument): if isinstance(arg, ExecutableArgument):

View File

@ -53,17 +53,6 @@ class ConfigurationABC(ABC):
""" """
pass pass
@abstractmethod
def parse_console_arguments(self, error: bool = None):
r"""Reads the console arguments
Parameter
---------
error: :class:`bool`
Defines is invalid argument error will be shown or not
"""
pass
@abstractmethod @abstractmethod
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None): def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
r"""Reads and saves settings from given json file r"""Reads and saves settings from given json file
@ -120,6 +109,17 @@ class ConfigurationABC(ABC):
""" """
pass pass
@abstractmethod
def for_each_argument(self, call: Callable):
r"""Iterates through all arguments and calls the call function
Parameter
---------
call: :class:`Callable`
Call for each argument
"""
pass
@abstractmethod @abstractmethod
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[ def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[
str, ConfigurationModelABC]: str, ConfigurationModelABC]:
@ -136,6 +136,17 @@ class ConfigurationABC(ABC):
""" """
pass pass
@abstractmethod
def parse_console_arguments(self, error: bool = None):
r"""Reads the console arguments
Parameter
---------
error: :class:`bool`
Defines is invalid argument error will be shown or not
"""
pass
@abstractmethod @abstractmethod
def resolve_runnable_argument_types(self, services: 'ServiceProviderABC'): def resolve_runnable_argument_types(self, services: 'ServiceProviderABC'):
r"""Gets all objects for given types of ConsoleArguments r"""Gets all objects for given types of ConsoleArguments

View File

@ -20,6 +20,8 @@ __version__ = '2022.6.3.dev2'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .scope import Scope
from .scope_abc import ScopeABC
from .service_collection import ServiceCollection from .service_collection import ServiceCollection
from .service_collection_abc import ServiceCollectionABC from .service_collection_abc import ServiceCollectionABC
from .service_descriptor import ServiceDescriptor from .service_descriptor import ServiceDescriptor

View File

@ -28,5 +28,5 @@ class ParameterStartup(StartupExtensionABC):
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
services \ services \
.add_singleton(GenerateArgument) \ .add_transient(GenerateArgument) \
.add_singleton(InstallArgument) .add_singleton(InstallArgument)