-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
Prompt: Replaced 'read' with high-level 'prompt' library #213
Conversation
function evaluatePrompts(prompt) { | ||
if (_.isFunction(prompt.default)) { | ||
prompt.default = prompt.default(); | ||
} else if (prompt.default === true || prompt.default === false) { |
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.
} else if (typeof prompt.default === 'boolean') {
?
The error message on invalid input is a bit awkwards since it repeats the question:
Should rather be:
Otherwise lgtm |
Exported as single module now. Monkey-patching is probably our best option at the moment, unless someone has a better idea. |
Ouch, the prompt lib makes use of the color grey which makes questions invisible on Solarized Dark. |
Yeah, I used to use Solarized Dark myself, but switch to Solarized Light for most tasks, because bower uses the same invisible colors. |
Yeah, but we probably need to address this in some way since Solarized is pretty widely used or else people will create issues about it. Bower has fixed their colours. Mocha haven't though which is pretty painful. |
Relevant discussion: altercation/solarized#220 |
There's severals issues opened about it on the Solarized repo but it seems like he won't fix it. |
That's unfortunate, because I definitely consider this a bug. :/ |
I'd like to go one step further and disable colors globally if yo is started with that option. Since you can add custom 'themes' to the |
I like that suggestion @passy. |
/ref yeoman#199 This changes the prompt API slightly and adds the following features: - `grunt-init` style coloring - `default` can be a function (in preperation of "magic defaults") - if `default` is a boolean, it will display a 'y/n' prompt with proper validation - validations occurs after a value is entered and not after the whole wizard completed
We decided to postpone the color option, because it's not directly related. It will definitely be tackled soon, though. I rebased on top of master, fixed the merge conflict and did some manual testing with various generators where I couldn't find any problems. Does anyone know of a more elaborate use of the prompt system somewhere else that this could break? |
Prompt: Replaced 'read' with high-level 'prompt' library
Great stuff @passy, here are some cakes. Don't eat them all at once. 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 🍰 |
Will the read properties in yo be replaced by prompt properties, i.e current yeoman docs |
Sorry, should have commented earlier but this didn't work for me. Answers didn't get passed on. |
Could you elaborate? Where does that happen? |
I just tested with the webapp generator. If I chose to use RequireJS the first time for example and then ran it again without RequireJS the file would be identical anyway. I'm not sure that the default values even worked. |
@kevva Thanks, looking into it. |
@kevva Could you check again? I misinterpreted how API is supposed to be used, should be backwards-compatible now. |
@passy, cake for you, works now! I do think we should remove the color for the text in the question though, which is just a matter of a oneliner. |
@kevva Feel free to remove it. We can re-add it once we found a solution how to disable colors globally. |
Yay, I can see again without having to mark the text 👓 |
/ref #199
This changes the prompt API slightly and adds the following features:
grunt-init
style coloringdefault
can be a function (in preperation of "magic defaults")default
is a boolean, it will display a 'y/n' prompt with propervalidation
completed
Watch it in action: http://ascii.io/a/2855
(I actually opened a new PR instead of continuing #198, but this has nothing to do anymore with filters, so I feel this is justified. :P)