Skip to content

fix: prompt when parameter options are incompatible #9247

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

Merged
merged 13 commits into from
Aug 23, 2023
Prev Previous commit
Next Next commit
wip: do not ask for required immutables on update
  • Loading branch information
mtojek committed Aug 22, 2023
commit 349c6ca1d068e52137f5ebd1ffe9f5bd0ad16bcd
1 change: 0 additions & 1 deletion cli/parameterresolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ func (pr *ParameterResolver) resolveWithInput(resolved []codersdk.WorkspaceBuild
if (tvp.Ephemeral && pr.promptBuildOptions) ||
(action == WorkspaceCreate && tvp.Required) ||
(action == WorkspaceCreate && !tvp.Ephemeral) ||
(action == WorkspaceUpdate && tvp.Required) ||
(action == WorkspaceUpdate && !tvp.Mutable && firstTimeUse) ||
(action == WorkspaceUpdate && tvp.Mutable && !tvp.Ephemeral && pr.promptRichParameters) {
parameterValue, err := cliui.RichParameter(inv, tvp)
Expand Down
2 changes: 2 additions & 0 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,8 @@ func (p *prettyErrorFormatter) format(err error) {
msg = sdkError.Message
if sdkError.Helper != "" {
msg = msg + "\n" + sdkError.Helper
} else if sdkError.Detail != "" {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reviewers:

Message: "Unable to validate parameter X"
Detail: "parameter value must match one of options"

^ this should be consistent with site UI error

msg = msg + "\n" + sdkError.Detail
}
// The SDK error is usually good enough, and we don't want to overwhelm
// the user with output.
Expand Down