mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user