2021-03-16 18:28:31 +01:00
|
|
|
import traceback
|
|
|
|
from typing import Optional
|
|
|
|
|
2021-08-05 14:21:42 +02:00
|
|
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
|
|
from cpl_core.console.console import Console
|
2021-03-16 18:28:31 +01:00
|
|
|
from cpl_cli.cli_settings_name_enum import CLISettingsNameEnum
|
|
|
|
|
|
|
|
|
|
|
|
class CLISettings(ConfigurationModelABC):
|
|
|
|
def __init__(self):
|
|
|
|
ConfigurationModelABC.__init__(self)
|
|
|
|
|
|
|
|
self._pip_path: Optional[str] = None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def pip_path(self) -> str:
|
|
|
|
return self._pip_path
|
|
|
|
|
|
|
|
def from_dict(self, settings: dict):
|
|
|
|
try:
|
|
|
|
self._pip_path = settings[CLISettingsNameEnum.pip_path.value]
|
|
|
|
except Exception as e:
|
2023-02-20 15:55:20 +01:00
|
|
|
Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
|
|
|
|
Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
|