Improved configuration

This commit is contained in:
2021-03-03 18:37:39 +01:00
parent ed0b761502
commit b32f846fcf
9 changed files with 164 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
from abc import abstractmethod, ABC
from collections import Callable
from typing import Type
from typing import Type, Union
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.environment.environment_abc import EnvironmentABC
@@ -15,11 +15,18 @@ class ConfigurationABC(ABC):
@abstractmethod
def environment(self) -> EnvironmentABC: pass
@property
@abstractmethod
def additional_arguments(self) -> list[str]: pass
@abstractmethod
def add_environment_variables(self, prefix: str): pass
@abstractmethod
def add_argument_variables(self): pass
def add_console_argument(self, token: str, name: str, aliases: list[str], value_token: str): pass
@abstractmethod
def add_console_arguments(self): pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None): pass
@@ -28,4 +35,4 @@ class ConfigurationABC(ABC):
def add_configuration(self, key_type: type, value: object): pass
@abstractmethod
def get_configuration(self, search_type: Type[ConfigurationModelABC]) -> Callable[ConfigurationModelABC]: pass
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[str, Callable[ConfigurationModelABC]]: pass