MCPcopy Create free account
hub / github.com/compozy/agh / newWorkspaceRemoveCommand

Function newWorkspaceRemoveCommand

internal/cli/workspace.go:321–345  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

319}
320
321func newWorkspaceRemoveCommand(deps commandDeps) *cobra.Command {
322 return &cobra.Command{
323 Use: "remove <name-or-id>",
324 Short: "Remove a workspace registration and stopped session history",
325 Example: ` # Remove a workspace registration by name
326 agh workspace remove checkout-api`,
327 Args: exactOneNonBlankArg(),
328 RunE: func(cmd *cobra.Command, args []string) error {
329 client, err := clientFromDeps(deps)
330 if err != nil {
331 return err
332 }
333
334 detail, err := client.GetWorkspace(cmd.Context(), args[0])
335 if err != nil {
336 return err
337 }
338 if err := client.DeleteWorkspace(cmd.Context(), detail.Workspace.ID); err != nil {
339 return err
340 }
341
342 return writeCommandOutput(cmd, workspaceRecordBundle(detail.Workspace))
343 },
344 }
345}
346
347func workspaceRecordBundle(item WorkspaceRecord) outputBundle {
348 return outputBundle{

Callers 1

newWorkspaceCommandFunction · 0.85

Calls 6

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
workspaceRecordBundleFunction · 0.85
GetWorkspaceMethod · 0.65
DeleteWorkspaceMethod · 0.65

Tested by

no test coverage detected