Fixed workspace loading error for update command

This commit is contained in:
Sven Heidemann 2021-04-11 13:15:19 +02:00
parent 1c353bbcdf
commit 314bb1b722

View File

@ -31,9 +31,6 @@ class CommandHandler(ABC):
def commands(self) -> list[CommandModel]: def commands(self) -> list[CommandModel]:
return self._commands return self._commands
def _load_json(self):
pass
def add_command(self, cmd: CommandModel): def add_command(self, cmd: CommandModel):
self._commands.append(cmd) self._commands.append(cmd)
@ -74,8 +71,8 @@ class CommandHandler(ABC):
if os.path.isfile(project_path_camel_case): if os.path.isfile(project_path_camel_case):
project_name = String.convert_to_camel_case(name) project_name = String.convert_to_camel_case(name)
if command.is_workspace_needed: if command.is_workspace_needed or command.is_workspace_needed and project_name is None:
if workspace is None and project_name is None: if workspace is None:
Error.error( Error.error(
'The command requires to be run in an CPL workspace or project, ' 'The command requires to be run in an CPL workspace or project, '
'but a workspace or project could not be found.' 'but a workspace or project could not be found.'
@ -85,8 +82,6 @@ class CommandHandler(ABC):
if project_name is None: if project_name is None:
project_name = workspace.default_project project_name = workspace.default_project
Console.write_line(project_name)
self._config.add_configuration('ProjectName', project_name) self._config.add_configuration('ProjectName', project_name)
project_json = f'{project_name}.json' project_json = f'{project_name}.json'