mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
* fix: Remove unused workspace routes in favor of list with filter This consolidates the workspace routes into a single place. It allows users to fetch a workspace by their username and workspace name, which will be used by the frontend for routing. * Fix RBAC * Fix CLI usages
35 lines
920 B
Go
35 lines
920 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/coder/coder/cli/cliui"
|
|
)
|
|
|
|
func show() *cobra.Command {
|
|
return &cobra.Command{
|
|
Annotations: workspaceCommand,
|
|
Use: "show",
|
|
Short: "Show details of a workspace's resources and agents",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
client, err := createClient(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
workspace, err := namedWorkspace(cmd, client, args[0])
|
|
if err != nil {
|
|
return xerrors.Errorf("get workspace: %w", err)
|
|
}
|
|
resources, err := client.WorkspaceResourcesByBuild(cmd.Context(), workspace.LatestBuild.ID)
|
|
if err != nil {
|
|
return xerrors.Errorf("get workspace resources: %w", err)
|
|
}
|
|
return cliui.WorkspaceResources(cmd.OutOrStdout(), resources, cliui.WorkspaceResourcesOptions{
|
|
WorkspaceName: workspace.Name,
|
|
})
|
|
},
|
|
}
|
|
}
|