Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Rename remove CLI command for archive #709

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/codegate/pipeline/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def subcommands(self) -> Dict[str, Callable[[List[str]], Awaitable[str]]]:
"list": self._list_workspaces,
"add": self._add_workspace,
"activate": self._activate_workspace,
"remove": self._remove_workspace,
"archive": self._archive_workspace,
"rename": self._rename_workspace,
"list-archived": self._list_archived_workspaces,
"restore": self._restore_workspace,
Expand Down Expand Up @@ -249,16 +249,16 @@ async def _activate_workspace(self, flags: Dict[str, str], args: List[str]) -> s
return "An error occurred while activating the workspace"
return f"Workspace **{workspace_name}** has been activated"

async def _remove_workspace(self, flags: Dict[str, str], args: List[str]) -> str:
async def _archive_workspace(self, flags: Dict[str, str], args: List[str]) -> str:
"""
Remove a workspace
"""
if args is None or len(args) == 0:
return "Please provide a name. Use `codegate workspace remove workspace_name`"
return "Please provide a name. Use `codegate workspace archive workspace_name`"

workspace_name = args[0]
if not workspace_name:
return "Please provide a name. Use `codegate workspace remove workspace_name`"
return "Please provide a name. Use `codegate workspace archive workspace_name`"

try:
await self.workspace_crud.soft_delete_workspace(workspace_name)
Expand All @@ -267,8 +267,8 @@ async def _remove_workspace(self, flags: Dict[str, str], args: List[str]) -> str
except crud.WorkspaceCrudError as e:
return str(e)
except Exception:
return "An error occurred while removing the workspace"
return f"Workspace **{workspace_name}** has been removed"
return "An error occurred while archiving the workspace"
return f"Workspace **{workspace_name}** has been archived"

async def _list_archived_workspaces(self, flags: Dict[str, str], args: List[str]) -> str:
"""
Expand Down Expand Up @@ -337,7 +337,7 @@ def help(self) -> str:
"- `activate`: Activate a workspace\n\n"
" - *args*:\n\n"
" - `workspace_name`\n\n"
"- `remove`: Remove a workspace\n\n"
"- `archive`: Archive a workspace\n\n"
" - *args*:\n\n"
" - `workspace_name`\n\n"
"- `rename`: Rename a workspace\n\n"
Expand Down
Loading