mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: implement rich multi-selector (#19201)
Fixes: https://github.com/coder/coder/issues/19182
This commit is contained in:
@@ -38,15 +38,16 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te
|
||||
// Move the cursor up a single line for nicer display!
|
||||
_, _ = fmt.Fprint(inv.Stdout, "\033[1A")
|
||||
|
||||
var options []string
|
||||
err = json.Unmarshal([]byte(templateVersionParameter.DefaultValue), &options)
|
||||
var defaults []string
|
||||
err = json.Unmarshal([]byte(templateVersionParameter.DefaultValue), &defaults)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
values, err := MultiSelect(inv, MultiSelectOptions{
|
||||
Options: options,
|
||||
Defaults: options,
|
||||
values, err := RichMultiSelect(inv, RichMultiSelectOptions{
|
||||
Options: templateVersionParameter.Options,
|
||||
Defaults: defaults,
|
||||
EnableCustomInput: templateVersionParameter.FormType == "tag-select",
|
||||
})
|
||||
if err == nil {
|
||||
v, err := json.Marshal(&values)
|
||||
|
||||
Reference in New Issue
Block a user