Skip to content

fix: return empty array if no option multi-selected #19224

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 3 commits into from
Aug 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: return empty array if no option multi-selected
  • Loading branch information
mtojek committed Aug 7, 2025
commit 3726e28902f65dc671f31bdc6552ae705136835f
6 changes: 5 additions & 1 deletion cli/cliui/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ func RichMultiSelect(inv *serpent.Invocation, richOptions RichMultiSelectOptions
}

// Check selected option, convert descriptions (line) to values
var results []string
//
// The function must return an initialized empty array, since it is later marshalled
// into JSON. Otherwise, `var results []string` would be marshalled to "null".
// See: https://github.com/golang/go/issues/27589
results := []string{}
for _, sel := range selected {
custom := true
for i, option := range richOptions.Options {
Expand Down
Loading