Socket
Socket
Sign inDemoInstall

inquirer

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer

A collection of common interactive command line user interfaces.


Version published
Weekly downloads
23M
decreased by-13.87%
Maintainers
1
Weekly downloads
 
Created

What is inquirer?

The inquirer npm package is a collection of common interactive command line user interfaces. It provides an easy way to capture user input in a variety of ways such as lists, confirmations, and text input, which are useful for building command-line tools and scripts.

What are inquirer's main functionalities?

Text Input

Captures freeform text input from the user.

const inquirer = require('inquirer');
inquirer.prompt([{ type: 'input', name: 'username', message: 'What is your username?' }]).then(answers => { console.log(`Hello, ${answers.username}!`); });

Confirmation

Asks the user a yes/no question.

const inquirer = require('inquirer');
inquirer.prompt([{ type: 'confirm', name: 'continue', message: 'Do you wish to continue?' }]).then(answers => { console.log(`You chose to ${answers.continue ? 'continue' : 'stop'}.`); });

List

Presents a list of options for the user to choose from.

const inquirer = require('inquirer');
inquirer.prompt([{ type: 'list', name: 'selection', message: 'Choose an option:', choices: ['Option 1', 'Option 2', 'Option 3'] }]).then(answers => { console.log(`You selected: ${answers.selection}`); });

Checkbox

Allows the user to select multiple options from a list.

const inquirer = require('inquirer');
inquirer.prompt([{ type: 'checkbox', name: 'features', message: 'What features do you want?', choices: ['Feature A', 'Feature B', 'Feature C'] }]).then(answers => { console.log(`You selected: ${answers.features.join(', ')}`); });

Password

Asks the user for a password, input is hidden on the terminal.

const inquirer = require('inquirer');
inquirer.prompt([{ type: 'password', name: 'password', message: 'Enter your password:' }]).then(answers => { console.log('Password captured'); });

Other packages similar to inquirer

Keywords

FAQs

Package last updated on 21 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc