A collection of common interactive command line user interfaces.. Use when: providing _error feedback_; _asking questions_; _validating_ answers. NOT for: web browser UI rendering; server-side HTML generation.
A collection of common interactive command line user interfaces.. While it still receives maintenance, it is not actively developed.
npm install inquirer
npm install inquirer
yarn add inquirer
import inquirer from 'inquirer';
inquirer
.prompt([
/* Pass your questions in here */
])
.then((answers) => {
// Use user feedback for... whatever!!
})
.catch((error) => {
if (error.isTtyError) {
// Prompt couldn't be rendered in the current environment
} else {
// Something else went wrong
}
});
yarn node packages/inquirer/examples/pizza.js
yarn node packages/inquirer/examples/checkbox.js
# etc...
const prompt = inquirer.createPromptModule();
prompt(questions).then(/* ... */);
See the official documentation for configuration options and advanced settings.