This commit is contained in:
Sven Heidemann 2021-03-12 20:37:31 +01:00
parent 6a1e7d4063
commit 3d001ade0a
7 changed files with 46 additions and 23 deletions

View File

@ -1,3 +1,2 @@
- create console select with up & down arrows
- add command start - add command start
- add command update - add command update

View File

@ -10,7 +10,7 @@ from cpl.configuration.configuration_variable_name_enum import ConfigurationVari
from cpl.configuration.console_argument import ConsoleArgument from cpl.configuration.console_argument import ConsoleArgument
from cpl.console.console import Console from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.environment.hosting_environment import HostingEnvironment from cpl.environment.application_environment import ApplicationEnvironment
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import EnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum from cpl.environment.environment_name_enum import EnvironmentNameEnum
@ -20,7 +20,7 @@ class Configuration(ConfigurationABC):
def __init__(self): def __init__(self):
ConfigurationABC.__init__(self) ConfigurationABC.__init__(self)
self._hosting_environment = HostingEnvironment() self._hosting_environment = ApplicationEnvironment()
self._config: dict[Union[type, str], Union[ConfigurationModelABC, str]] = {} self._config: dict[Union[type, str], Union[ConfigurationModelABC, str]] = {}
self._argument_types: list[ConsoleArgument] = [] self._argument_types: list[ConsoleArgument] = []
@ -70,7 +70,7 @@ class Configuration(ConfigurationABC):
def _set_variable(self, name: str, value: str): def _set_variable(self, name: str, value: str):
if name == ConfigurationVariableNameEnum.environment.value: if name == ConfigurationVariableNameEnum.environment.value:
self._hosting_environment.environment_name = EnvironmentName(value) self._hosting_environment.environment_name = EnvironmentNameEnum(value)
elif name == ConfigurationVariableNameEnum.name.value: elif name == ConfigurationVariableNameEnum.name.value:
self._hosting_environment.application_name = value self._hosting_environment.application_name = value

View File

@ -22,7 +22,7 @@ from collections import namedtuple
# imports: # imports:
from .environment_abc import EnvironmentABC from .environment_abc import EnvironmentABC
from .environment_name_enum import EnvironmentNameEnum from .environment_name_enum import EnvironmentNameEnum
from .hosting_environment import HostingEnvironment from .application_environment import ApplicationEnvironment
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2021, minor=4, micro=1) version_info = VersionInfo(major=2021, minor=4, micro=1)

View File

@ -5,7 +5,7 @@ from cpl.environment.environment_abc import EnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum from cpl.environment.environment_name_enum import EnvironmentNameEnum
class HostingEnvironment(EnvironmentABC): class ApplicationEnvironment(EnvironmentABC):
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'): def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
EnvironmentABC.__init__(self) EnvironmentABC.__init__(self)
@ -21,7 +21,7 @@ class HostingEnvironment(EnvironmentABC):
@environment_name.setter @environment_name.setter
def environment_name(self, environment_name: str): def environment_name(self, environment_name: str):
self._environment_name = EnvironmentName(environment_name) self._environment_name = EnvironmentNameEnum(environment_name)
@property @property
def application_name(self) -> str: def application_name(self) -> str:

View File

@ -8,8 +8,7 @@ def test_spinner():
if __name__ == '__main__': if __name__ == '__main__':
Console.write_line('Hello World') Console.write_line('Hello World')
# Console.spinner('Test:', test_spinner, spinner_foreground_color=ForegroundColorEnum.cyan, Console.spinner('Test:', test_spinner, spinner_foreground_color=ForegroundColorEnum.cyan, text_foreground_color='green')
# text_foreground_color='green')
opts = [ opts = [
'Option 1', 'Option 1',
'Option 2', 'Option 2',

View File

@ -1,24 +1,44 @@
{ {
"ProjectSettings": { "ProjectSettings": {
"Name": "sh_cpl.tests", "Name": "sh_cpl.tests",
"Author": "Sven Heidemann",
"Description": "Common Python Library CLI",
"LongDescription": "Common Python Library CLI",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Version": { "Version": {
"Major": "2021", "Major": "2021",
"Minor": "04", "Minor": "04",
"Micro": "01" "Micro": "01"
}, },
"SourcePath": "./", "Author": "Sven Heidemann",
"DistPath": "../../dist", "AuthorEmail": "sven.heidemann@sh-edraft.de",
"Included": [], "Description": "sh-edraft Common Python library",
"LongDescription": "sh-edraft Common Python library",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2020 - 2021",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"mysql-connector",
"SQLAlchemy",
"termcolor",
"pyfiglet",
"tabulate",
"pynput"
],
"PythonVersion": ">=3.8"
},
"BuildSettings": {
"SourcePath": "",
"OutputPath": "dist",
"Main": "main",
"EntryPoint": "cpl",
"IncludePackageData": "False",
"Included": [
"*/templates"
],
"Excluded": [ "Excluded": [
"__pycache__", "*/__pycache__",
"logs" "*/logs",
] "*/tests"
],
"PackageData": {}
} }
} }

View File

@ -1,8 +1,13 @@
from tests.custom.general.application import Application from tests.custom.general.application import Application
from tests.custom.general.startup import Startup from tests.custom.general.startup import Startup
if __name__ == '__main__':
def main():
app = Application() app = Application()
app.use_startup(Startup) app.use_startup(Startup)
app.build() app.build()
app.run() app.run()
if __name__ == '__main__':
main()