Can run InquirerJS in sync mode?
Example:
var answers = inquirer.prompt([...]);
Nope. As we ask for user input, there's no way to block processing and make it synchronous.
@SBoudrias Why is that ? I don't quite get it, ask user input synchronously is what I'd do in many languages. The case where you wait for user input and cannot do anything without it is pretty common.
@AdrienHorgnies Yeah, common in a lot of languages, but Node.js doesn't have a synchronous Readline module https://nodejs.org/api/readline.html - so unfortunately, this isn't possible.
That being said, you can leverage the await/async functions to get a similar style
const { name } = await inquirer.prompt();
Most helpful comment
@AdrienHorgnies Yeah, common in a lot of languages, but Node.js doesn't have a synchronous Readline module https://nodejs.org/api/readline.html - so unfortunately, this isn't possible.
That being said, you can leverage the
await/asyncfunctions to get a similar style