-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: transformChoice
options for checkbox
#1349
Comments
transformChoice
options for checkboxtransformChoice
options for checkbox
The older checkbox prompt had a I don't know we need to keep the same API, but it's an option. Also, if we want to shorten the display, maybe we're better with a rendering function receiving the whole option list (so you could custom format like "a, b and 3 others", etc) |
@SBoudrias Are you open for a PR? |
Yes, happy to review and merge a PR. I would recommend us aligning on the right approach to the problem though - want to make sure you don't waste your time if we end up feeling a different API would cover more cases! |
I would go with your second option, to provide a rendering function. I think it is the most flexible option. We could provide the rendering function with the list of all options AND the list of all selected options. Something like: type RenderFn = (choices: ReadonlyArray<Choice<Value> | Separator>, selectedChoices: ReadonlyArray<Choice<Value>>) => string But I'm open to everything. |
Yeah, that works. I like it - it's probably the most flexible option. Just a nit that I'd flip the function params for all choices and selected choices. |
After the selection within the checkbox prompt is made, the selected values are printed to
stdout
. This can look very messy if the name of the choice is very long. The reason for this is this line:Inquirer.js/packages/checkbox/src/index.mts
Line 173 in a3ab276
An option like
transformChoice
could solve the problem. The line could then be updated to like this for example:If I get the OK, I would also work on it right away.
The text was updated successfully, but these errors were encountered: