Added logic to cpl cli to change cwd only when wanted

This commit is contained in:
2021-04-11 11:12:39 +02:00
parent d51659db3e
commit 284ebe1b11
4 changed files with 26 additions and 17 deletions

View File

@@ -5,11 +5,13 @@ from cpl_cli.command_abc import CommandABC
class CommandModel:
def __init__(self, name: str, aliases: list[str], command: Callable[CommandABC], is_project_needed: bool):
def __init__(self, name: str, aliases: list[str], command: Callable[CommandABC], is_project_needed: bool,
change_cwd: bool):
self._name = name
self._aliases = aliases
self._command = command
self._is_project_needed = is_project_needed
self._change_cwd = change_cwd
@property
def name(self) -> str:
@@ -18,11 +20,15 @@ class CommandModel:
@property
def aliases(self) -> list[str]:
return self._aliases
@property
def command(self) -> Callable[CommandABC]:
return self._command
@property
def is_project_needed(self) -> bool:
return self._is_project_needed
@property
def change_cwd(self) -> bool:
return self._change_cwd