Open maxlinc opened 9 years ago
+1. Please? Prompting for a multiple choice feels messy how it is now. Having an up/down arrow select like Yeoman, in addition to selecting by index, would be beyond perfect.
@maxlinc @ezekg Though your requirement for list menu is quite often necessary in building CLI apps, I think it maybe slightly out of scope for thor. I would prefer for thor to be 'mighty hammer' rather than 'swiss army-knife' for CLI development. I'm not a thor maintainer, therefore I cannot express the views for the future of the library but my own. If you are still interested in this functionality, I've been recently working on library that helps building user prompts tty-prompt.
That looks pretty awesome @peter-murach, thanks for sharing.
I think it would be useful to have a Thor shell command for selecting from a list of options. This is fairly common in CLI applications, e.g.:
The closest Thor currently has to this behavior is:
I do like the autocomplete support to select by value via Thor ask, but it isn't a good solution for long lists or long names since it displays an inline list rather than the question, list, then prompt format in the original example above.
In fact, to support very long lists my ideal implementation would:
ask ... :limited_by
to_s
or another callback to determine display names) so the caller doesn't need to uselist.find
on the results.Basically something that behaves like this, where both
4
orAuto Scale - List scaling groups
are equivalent selections: