fix(cli/cliui): apply defaults when rendering select prompts (#22093)

The `--parameter-default` value is now used to pre-select the default option for a coder parameter
with option blocks when prompting interactively in CLI.

Related to: https://github.com/coder/coder/issues/22078
This commit is contained in:
George K
2026-03-05 09:35:57 -08:00
committed by GitHub
parent dba688662c
commit 5dd570f099
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -123,6 +123,10 @@ func Select(inv *serpent.Invocation, opts SelectOptions) (string, error) {
initialModel.height = defaultSelectModelHeight
}
if idx := slices.Index(opts.Options, opts.Default); idx >= 0 {
initialModel.cursor = idx
}
initialModel.search.Prompt = ""
initialModel.search.Focus()