You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #457, I'd like to see some discussion on more ways to gather user input. Right now, if you want to do anything other than ask a simple question with ask, then you're either left to fend for yourself, or you have to use an option like :limited_to, which is not ideal (more on that particular issue is discussed in the link above). Below are some simple proposals to start the discussion.
Actions
Shell select menu:
Shell select menu with an up/down arrow selection.
? What would you like to do?
Item 1
> Item 2
Item 3
Shell radio menu:
Shell radio select menu. Use spacebar for selection like web forms?
? Which version would you like to use?
Item 1
Item 2
Item 3
> Ite
Prompt sets
Ability to create 'sets' of prompts/actions that can be rewound (back) and fast-forwarded (skip) similar to Interact with the left/right arrow keys. Nothing is worse than inputting a typo and having to ctr+c out of the script and restart.
I'd like to see an option to style the select items differently from the actual method color. Maybe something like how HighLine does it:
choosedo |menu|
menu.prompt=set_color("Please choose your favorite programming language:",:blue)# Add single choice, and message if chosenmenu.choice:rubydoset_color(say("Good choice!"),:green)end# Add array of choices and a message if either is chosenmenu.choices(:python,:perl)doset_color(say("Not from around here, are you?"),:yellow)endend
In addition to styling the new actions, I think that we should also be able to color the (:default) string (and possibly other options) differently from the rest of the text. For example:
ask"Site name:",:cyan,:default=>"site"
Will output the entire string Site name: (site) as the same color. Being able to differentiate these two would produce a better overall user experience. I think the best example of great actions and user experience for user input is Yeoman.
Discussion
I wanted to get some discussion going before diving straight into something like this. Is this even something that would want to be implemented into Thor? My team has been using Thor for scaffolding / setup scripts, and the more complex our setups get, the more we wish that these features were available.
Thoughts? Additional ideas? Let's hear 'em.
The text was updated successfully, but these errors were encountered:
I extended Thor a bit IO-wise for a recent project if anybody wants to check it out. It has shell select menus that can be navigated with the arrow keys, unicode icons, easier-to-use implementation of colors, indentation, more user-friendly questions, etc. It's compatible with MRI >= 1.9.3.
@ezekg The menu functionality you have described is very important but I would also argue that thor is not necessarily the place to add it to. I think it would be good to keep thor focused and not to become a magnet for attracting anything connected with CLI app development. I see thor core functionality as object oriented command line options parser.
If you are still looking for something that handles your use cases you can try using tty-prompt that I've been working on recently. It's not complete by any means but it already sports quite few prompt helpers and should integrate with thor nicely.
Similar to #457, I'd like to see some discussion on more ways to gather user input. Right now, if you want to do anything other than ask a simple question with
ask
, then you're either left to fend for yourself, or you have to use an option like:limited_to
, which is not ideal (more on that particular issue is discussed in the link above). Below are some simple proposals to start the discussion.Actions
Shell select menu:
Shell select menu with an up/down arrow selection.
Shell radio menu:
Shell radio select menu. Use spacebar for selection like web forms?
Indexed menu:
Standard select by index.
Standard menu:
Standard select by name.
Prompt sets
Ability to create 'sets' of prompts/actions that can be rewound (back) and fast-forwarded (skip) similar to Interact with the left/right arrow keys. Nothing is worse than inputting a typo and having to
ctr+c
out of the script and restart.Styling
I'd like to see an option to style the select items differently from the actual method color. Maybe something like how HighLine does it:
In addition to styling the new actions, I think that we should also be able to color the
(:default)
string (and possibly other options) differently from the rest of the text. For example:Will output the entire string
Site name: (site)
as the same color. Being able to differentiate these two would produce a better overall user experience. I think the best example of great actions and user experience for user input is Yeoman.Discussion
I wanted to get some discussion going before diving straight into something like this. Is this even something that would want to be implemented into Thor? My team has been using Thor for scaffolding / setup scripts, and the more complex our setups get, the more we wish that these features were available.
Thoughts? Additional ideas? Let's hear 'em.
The text was updated successfully, but these errors were encountered: