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
Handle questions as a plain object {[name]: question} #885
Conversation
bf48047
to
bf365e1
Compare
@SBoudrias Do you think we could do that? |
Hey, will this be merged one day? |
@codinghusi I gave up, using http://npm.im/prompt instead |
Oh nice, there's another package for that :) May I ask, what kind of problem you had with merging? As I could see, it had only problems with code formatting guidelines. |
0bb05b2
to
5e79408
Compare
This is a breaking change, but I believe it's worth, it's easier to wrap a single question in [] and ```js const { foo, bar } = await inquirer.prompt({ foo: { message: '...', default: '...', }, bar: { default: '...', } }): ``` looks better imo and object literals keys are ordered (as long as they're not numeric)
Codecov Report
@@ Coverage Diff @@
## master #885 +/- ##
==========================================
+ Coverage 93.30% 93.32% +0.01%
==========================================
Files 27 27
Lines 1121 1123 +2
Branches 23 23
==========================================
+ Hits 1046 1048 +2
Misses 75 75
Continue to review full report at Codecov.
|
We use prompt package because it's light, support json-schema and we don't need fancy highlighting Ok I fixed the eslint issues, I don't have more time to spend on this sorry, it'd probably need tests |
8874fc1
to
059bc6d
Compare
Thanks for the PR. I think that's a good idea to reduce boilerplate a little. |
I think it's worth to support a questions object, like this:
it looks better imo,
{ foo, bar }
visually matches the corresponding keys in the question objectand object literals keys are ordered (as long as they're not numeric)
This PR detects such an object, safely normally, since a question should contain a
name
prop, there can't be a conflict with a single question object