Added console argument
This commit is contained in:
parent
3a1dd0525c
commit
7f1abc54ca
@ -4,6 +4,9 @@
|
|||||||
"Projects": {
|
"Projects": {
|
||||||
"py_to_uxf": "src/py_to_uxf/py_to_uxf.json"
|
"py_to_uxf": "src/py_to_uxf/py_to_uxf.json"
|
||||||
},
|
},
|
||||||
"Scripts": {}
|
"Scripts": {
|
||||||
|
"build-start": "cpl build; cd dist/py_to_uxf/build/py_to_uxf; echo \"Starting:\"; bash py_to_uxf --path ./",
|
||||||
|
"bs": "cpl build-start"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,8 +9,15 @@ class Application(ApplicationABC):
|
|||||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||||
ApplicationABC.__init__(self, config, services)
|
ApplicationABC.__init__(self, config, services)
|
||||||
|
|
||||||
|
self._path = config.get_configuration('path')
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
Console.write_line('Hello World')
|
Console.banner('Py to UXF')
|
||||||
|
if self._path is None:
|
||||||
|
Console.write_line('Expected path')
|
||||||
|
return
|
||||||
|
|
||||||
|
Console.write_line(f'Found path:', self._path)
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"TimeFormatSettings": {
|
|
||||||
"DateFormat": "%Y-%m-%d",
|
|
||||||
"TimeFormat": "%H:%M:%S",
|
|
||||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
|
||||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
|
||||||
},
|
|
||||||
|
|
||||||
"LoggingSettings": {
|
|
||||||
"Path": "logs/",
|
|
||||||
"Filename": "log_$start_time.log",
|
|
||||||
"ConsoleLogLevel": "ERROR",
|
|
||||||
"FileLogLevel": "WARN"
|
|
||||||
}
|
|
||||||
}
|
|
11
src/py_to_uxf/py_to_uxf
Normal file
11
src/py_to_uxf/py_to_uxf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
path="`dirname \"$0\"`" # relative
|
||||||
|
path="`( cd \"$path\" && pwd)`" # absolutized and normalized
|
||||||
|
|
||||||
|
cd "$path/../"
|
||||||
|
|
||||||
|
export PYTHONPATH=./:$PYTHONPATH
|
||||||
|
|
||||||
|
python3.9 py_to_uxf/main.py --path $@
|
||||||
|
echo ""
|
@ -1,5 +1,7 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
from cpl_core.application import StartupABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl_core.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC, ConsoleArgument
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
from cpl_core.environment import ApplicationEnvironment
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
|
|
||||||
@ -10,6 +12,9 @@ class Startup(StartupABC):
|
|||||||
StartupABC.__init__(self)
|
StartupABC.__init__(self)
|
||||||
|
|
||||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||||
|
environment.set_runtime_directory(os.path.dirname(__file__))
|
||||||
|
configuration.add_console_argument(ConsoleArgument('--', 'path', [], ' ', is_value_token_optional=False))
|
||||||
|
configuration.add_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:
|
||||||
|
Loading…
Reference in New Issue
Block a user