-
Notifications
You must be signed in to change notification settings - Fork 938
feat(cli): improve devcontainer support for coder show
#18793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ea9d210
eb04c1a
5519faa
1e5234c
f5fa73c
6bfa223
4d01a60
2eab390
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
coder show
Fixes coder/internal#747
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,17 @@ import ( | |
|
||
func (r *RootCmd) show() *serpent.Command { | ||
client := new(codersdk.Client) | ||
var details bool | ||
return &serpent.Command{ | ||
Use: "show <workspace>", | ||
Short: "Display details of a workspace's resources and agents", | ||
Options: serpent.OptionSet{ | ||
{ | ||
Flag: "details", | ||
Description: "Show full error messages and additional details.", | ||
Value: serpent.BoolOf(&details), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: explicit default value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it but it changes the CLI output to show default false. Not sure I like that to be honest since it's kinda clear that that's already the case. But either way works for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm easy either way, having an explicit default is easier to read but if it negatively impacts the help output we can skip it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't seem so bad to me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. IMO it's somewhat of a bug in serpent, doesn't really make sense to render the two cases differently and it could already inherit the default value from the current value of the variable given as pointer |
||
}, | ||
}, | ||
Middleware: serpent.Chain( | ||
serpent.RequireNArgs(1), | ||
r.InitClient(client), | ||
|
@@ -35,13 +43,15 @@ func (r *RootCmd) show() *serpent.Command { | |
options := cliui.WorkspaceResourcesOptions{ | ||
WorkspaceName: workspace.Name, | ||
ServerVersion: buildInfo.Version, | ||
ShowDetails: details, | ||
} | ||
if workspace.LatestBuild.Status == codersdk.WorkspaceStatusRunning { | ||
// Get listening ports for each agent. | ||
ports, devcontainers := fetchRuntimeResources(inv, client, workspace.LatestBuild.Resources...) | ||
options.ListeningPorts = ports | ||
options.Devcontainers = devcontainers | ||
} | ||
|
||
return cliui.WorkspaceResources(inv.Stdout, workspace.LatestBuild.Resources, options) | ||
}, | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.