-
Notifications
You must be signed in to change notification settings - Fork 887
feat: CLI use multiselect for list(string) #6631
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
Conversation
Back to draft, spotted a bug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it, but it looks good. The tests seem a bit superficial to me, if I understand correctly. But if it's the same with Select then I don't have an objection. (Although perhaps both should be improved in the future.)
@@ -118,6 +133,29 @@ func Select(cmd *cobra.Command, opts SelectOptions) (string, error) { | |||
return value, err | |||
} | |||
|
|||
func MultiSelect(cmd *cobra.Command, items []string) ([]string, error) { | |||
// Similar hack is applied to Select() | |||
if flag.Lookup("test.v") != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so it looks like we're not actually testing the multi select behavior with this hack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was surprised about it too, it just goes with the default. I wasn't able to properly simulate the user marking options.
Related: #6582
This PR enables support for multiselect in CLI, so that
coder
can render rich parameter typelist(string)
.