talira

Inquirer.js

Interactive command-line prompts for Node.js

open sourceMITfree

Inquirer.js is a collection of common interactive command-line prompts for Node.js and other JavaScript runtimes: input, select, checkbox, confirm, search, password, expand, raw list, number and an editor prompt that opens the user's $EDITOR. Each prompt is a function you await, with options for validation, defaults and custom input and output streams; @inquirer/core builds your own prompts and @inquirer/testing tests them, and @inquirer/i18n localizes them. The current @inquirer/prompts packages are a ground-up rewrite; the older inquirer package is still maintained but not actively developed. Works with npm, Yarn, pnpm, Bun and Deno. MIT licensed.

Problems it solves

  • ask the user questions in my Node.js command-line tool
  • show an arrow-key menu in a terminal script
  • let users pick several options with checkboxes in a CLI
  • prompt for a password without echoing it in Node.js
  • build an interactive setup wizard for my npm package

Features

  • input, select, checkbox, confirm, search, password, expand, raw list and number prompts
  • editor prompt that opens the user's $VISUAL or $EDITOR
  • API for building custom prompts (@inquirer/core)
  • testing utilities for prompts
  • localized prompts with @inquirer/i18n (English, French, Spanish, Chinese, Portuguese)
  • custom input and output streams

Alternatives

The same job

These do what Inquirer.js does.

  1. Commander.js The complete solution for Node.js command-line interfaces
  2. yargs Parse command-line arguments and build CLIs in Node.js
  3. oclif Salesforce's open CLI framework for building Node.js command-line tools
  4. minimist Minimal command-line argument parser for Node.js

Compare Inquirer.js with the top 3