Skip to content

Commit

Permalink
Rename remove CLI command for archive (#709)
Browse files Browse the repository at this point in the history
This is now `workspace archive`

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
  • Loading branch information
JAORMX authored Jan 22, 2025
1 parent f313dda commit 66bb8e2
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit 66bb8e2

Please sign in to comment.