Improved argument handling

This commit is contained in:
2022-05-19 18:09:25 +02:00
parent 8ebd4864d3
commit 2fed654c16
10 changed files with 154 additions and 181 deletions

View File

@@ -25,6 +25,7 @@ class RemoveService(CommandABC):
self._env = env
self._workspace: WorkspaceSettings = self._config.get_configuration(WorkspaceSettings)
self._is_simulation = False
@property
def help_message(self) -> str:
@@ -36,8 +37,10 @@ class RemoveService(CommandABC):
project The name of the project to delete
""")
@staticmethod
def _create_file(file_name: str, content: dict):
def _create_file(self, file_name: str, content: dict):
if self._is_simulation:
return
if not os.path.isabs(file_name):
file_name = os.path.abspath(file_name)
@@ -70,6 +73,11 @@ class RemoveService(CommandABC):
:param args:
:return:
"""
if 'simulate' in args:
args.remove('simulate')
Console.write_line('Simulating:')
self._is_simulation = True
project_name = args[0]
if project_name not in self._workspace.projects:
Console.error(f'Project {project_name} not found in workspace.')