@inquirer-cli

March 15, 2026 ยท View on GitHub

CI npm License: MIT

Interactive command-line prompts for shell scripts, powered by Inquirer.js.

The @inquirer-cli suite lets you add interactive prompts (text input, confirmations, selections, and more) to any shell script - no JavaScript required.

Quick Start

No installation needed. Run any prompt directly with npx:

name=$(npx -y @inquirer-cli/input "What is your name?")
echo "Hello, $name!"

Why -y? The -y flag auto-confirms the npx install prompt. Without it, the confirmation prompt would interfere when capturing output with $().

How It Works

Each prompt renders its UI to stderr and writes the user's answer to stdout. This means you can capture the answer with $() while the prompt remains visible in the terminal.

Prompts

@inquirer-cli/input

Prompts for free-text input.

name=$(npx -y @inquirer-cli/input -r "What is your name?")
echo "Hello, $name!"
OptionDescription
<message>The prompt message (required)
-r, --requiredReject empty input
-h, --helpShow help

@inquirer-cli/number

Prompts for numeric input.

age=$(npx -y @inquirer-cli/number -r "Enter your age")
echo "You are $age years old."
OptionDescription
<message>The prompt message (required)
-r, --requiredReject empty input
-h, --helpShow help

@inquirer-cli/confirm

Prompts for a yes/no confirmation. Outputs true or false.

if $(npx -y @inquirer-cli/confirm "Do you want to continue?"); then
  echo "Proceeding..."
else
  echo "Operation cancelled."
fi
OptionDescription
<message>The prompt message (required)
-y, --yesDefault to "yes" instead of "no"
-h, --helpShow help

@inquirer-cli/select

Prompts the user to pick one option from a list.

fruit=$(npx -y @inquirer-cli/select -c Apple -c Banana -c Cherry "Pick a fruit")
echo "You selected: $fruit"
OptionDescription
<message>The prompt message (required)
-c, --choice <value>Add a choice (use multiple times, at least one required)
-r, --requiredReject empty selection
-h, --helpShow help

@inquirer-cli/checkbox

Prompts the user to select multiple options from a list. Outputs selected values as a space-separated string.

colors=$(npx -y @inquirer-cli/checkbox -r "Select your favorite colors" -c Red -c Blue -c Green)
echo "You selected:"
for color in $colors; do
  echo "- $color"
done
OptionDescription
<message>The prompt message (required)
-c, --choice <value>Add a choice (use multiple times, at least one required)
-r, --requiredRequire at least one selection
-h, --helpShow help

@inquirer-cli/password

Prompts for sensitive input with masking.

secret=$(npx -y @inquirer-cli/password -r "Enter your password")
OptionDescription
<message>The prompt message (required)
-r, --requiredReject empty input
-h, --helpShow help

@inquirer-cli/editor (not supported yet)

Opens the user's default editor for multi-line input. This package is currently not functional due to technical difficulties. Contributions welcome!

notes=$(npx -y @inquirer-cli/editor "Write your notes")
echo "Your notes: $notes"

Full Example

#!/bin/sh

name=$(npx -y @inquirer-cli/input -r "What is your name?")
age=$(npx -y @inquirer-cli/number -r "How old are you?")
lang=$(npx -y @inquirer-cli/select -c JavaScript -c Python -c Go "Favorite language?")

if $(npx -y @inquirer-cli/confirm "Save profile?"); then
  echo "Saved: $name, age $age, likes $lang"
fi

Requirements

  • Node.js >= 20.12.0

Author

@ycmjason

License

MIT


@inquirer-cli is an independent project and is not affiliated with or endorsed by Inquirer.js.