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.
Install
npx skillscat add yusenthebot/skills-pack/inquirer Install via the SkillsCat registry.
SKILL.md
inquirer
Overview
A collection of common interactive command line user interfaces.. While it still receives maintenance, it is not actively developed.
Installation
npm install inquirerCore API / Usage
npm install inquireryarn add inquirerCommon Patterns
Pattern 1
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
}
});Pattern 2
yarn node packages/inquirer/examples/pizza.js
yarn node packages/inquirer/examples/checkbox.js
# etc...Pattern 3
const prompt = inquirer.createPromptModule();
prompt(questions).then(/* ... */);Configuration
See the official documentation for configuration options and advanced settings.
Tips & Gotchas
- This is the legacy version of Inquirer.js. While it still receives maintenance, it is not actively developed. For the new Inquirer, see @inquirer/prompts.
- Current version: 13.3.0. Check the changelog when upgrading across major versions.