(deps commandDeps)
| 95 | } |
| 96 | |
| 97 | func newWorkspaceListCommand(deps commandDeps) *cobra.Command { |
| 98 | return &cobra.Command{ |
| 99 | Use: workspaceListKey, |
| 100 | Short: "List registered workspaces", |
| 101 | Example: ` # Show every registered workspace |
| 102 | agh workspace list |
| 103 | |
| 104 | # Return workspace records as JSON |
| 105 | agh workspace list --output json`, |
| 106 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 107 | client, err := clientFromDeps(deps) |
| 108 | if err != nil { |
| 109 | return err |
| 110 | } |
| 111 | |
| 112 | workspaces, err := client.ListWorkspaces(cmd.Context()) |
| 113 | if err != nil { |
| 114 | return err |
| 115 | } |
| 116 | return writeCommandOutput(cmd, workspaceListBundle(workspaces)) |
| 117 | }, |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func newWorkspaceInfoCommand(deps commandDeps) *cobra.Command { |
| 122 | var workspaceRef string |
no test coverage detected