diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 73876b77..b39880c8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -22,10 +22,12 @@
-
-
+
-
+
+
+
+
@@ -97,7 +99,7 @@
-
+
@@ -486,13 +488,6 @@
1605881914521
-
- 1608049772153
-
-
-
- 1608049772153
-
1608059323858
@@ -829,7 +824,14 @@
1614837218919
-
+
+ 1614837337289
+
+
+
+ 1614837337289
+
+
@@ -845,8 +847,6 @@
-
-
@@ -870,7 +870,9 @@
-
+
+
+
diff --git a/src/cpl/application/application_host.py b/src/cpl/application/application_host.py
index d6f75cd0..2df94442 100644
--- a/src/cpl/application/application_host.py
+++ b/src/cpl/application/application_host.py
@@ -1,6 +1,5 @@
import atexit
from collections import Callable
-from datetime import datetime
from cpl.application.application_host_abc import ApplicationHostABC
from cpl.application.application_runtime import ApplicationRuntime
@@ -22,10 +21,6 @@ class ApplicationHost(ApplicationHostABC):
self._app_runtime = ApplicationRuntime(self._config)
self._services = ServiceProvider(self._app_runtime)
- # Set vars
- self._start_time: datetime = datetime.now()
- self._end_time: datetime = datetime.now()
-
@property
def configuration(self) -> ConfigurationABC:
return self._config
diff --git a/src/cpl/application/application_runtime.py b/src/cpl/application/application_runtime.py
index 165d0a79..4325b4ec 100644
--- a/src/cpl/application/application_runtime.py
+++ b/src/cpl/application/application_runtime.py
@@ -1,3 +1,4 @@
+import pathlib
from datetime import datetime
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
@@ -12,6 +13,8 @@ class ApplicationRuntime(ApplicationRuntimeABC):
self._app_configuration = config
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
+ self._working_directory = pathlib.Path().absolute()
+ self._runtime_directory = pathlib.Path(__file__).parent.absolute()
@property
def configuration(self) -> ConfigurationABC:
@@ -21,10 +24,6 @@ class ApplicationRuntime(ApplicationRuntimeABC):
def start_time(self) -> datetime:
return self._start_time
- @start_time.setter
- def start_time(self, start_time: datetime):
- self._start_time = start_time
-
@property
def end_time(self) -> datetime:
return self._end_time
@@ -36,3 +35,21 @@ class ApplicationRuntime(ApplicationRuntimeABC):
@property
def date_time_now(self) -> datetime:
return datetime.now()
+
+ @property
+ def working_directory(self) -> str:
+ return self._working_directory
+
+ def set_working_directory(self, path: str = ''):
+ if path != '':
+ self._working_directory = path
+ return
+
+ self._working_directory = pathlib.Path().absolute()
+
+ @property
+ def runtime_directory(self) -> str:
+ return self._runtime_directory
+
+ def set_runtime_directory(self, file: str):
+ self._runtime_directory = pathlib.Path(file).parent.absolute()
diff --git a/src/cpl/application/application_runtime_abc.py b/src/cpl/application/application_runtime_abc.py
index b562d7fa..8581fb51 100644
--- a/src/cpl/application/application_runtime_abc.py
+++ b/src/cpl/application/application_runtime_abc.py
@@ -32,3 +32,14 @@ class ApplicationRuntimeABC(ABC):
@property
@abstractmethod
def date_time_now(self) -> datetime: pass
+
+ @property
+ @abstractmethod
+ def working_directory(self) -> str: pass
+
+ @property
+ @abstractmethod
+ def runtime_directory(self) -> str: pass
+
+ @abstractmethod
+ def set_runtime_directory(self, runtime_directory: str): pass
diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py
index 8ceb1cfc..9ec776c7 100644
--- a/src/cpl_cli/startup.py
+++ b/src/cpl_cli/startup.py
@@ -22,18 +22,20 @@ class Startup(StartupABC):
def create_application_host(self) -> ApplicationHostABC:
self._app_host = ApplicationHost()
+
+ self._app_host.application_runtime.set_runtime_directory(__file__)
+ self._app_host.console_argument_error_function(Error.error)
+
self._configuration = self._app_host.configuration
self._services = self._app_host.services
- self._app_host.console_argument_error_function(Error.error)
-
return self._app_host
def create_configuration(self) -> ConfigurationABC:
self._configuration.add_environment_variables('PYTHON_')
self._configuration.add_environment_variables('CPL_')
- self._configuration.add_console_argument('', 'help', ['h'], '')
- self._configuration.add_console_argument('', 'version', ['v'], '')
+ self._configuration.add_console_argument('', 'help', ['-h', '-H'], '')
+ self._configuration.add_console_argument('', 'version', ['-v', '-V'], '')
self._configuration.add_console_arguments()
return self._configuration