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.
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-yflag auto-confirms thenpxinstall prompt. Without it, the confirmation prompt would interfere when capturing output with$().
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 for free-text input.
name=$(npx -y @inquirer-cli/input -r "What is your name?")
echo "Hello, $name!"| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-r, --required |
Reject empty input |
-h, --help |
Show help |
Prompts for numeric input.
age=$(npx -y @inquirer-cli/number -r "Enter your age")
echo "You are $age years old."| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-r, --required |
Reject empty input |
-h, --help |
Show help |
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| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-y, --yes |
Default to "yes" instead of "no" |
-h, --help |
Show help |
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"| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-c, --choice <value> |
Add a choice (use multiple times, at least one required) |
-r, --required |
Reject empty selection |
-h, --help |
Show help |
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| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-c, --choice <value> |
Add a choice (use multiple times, at least one required) |
-r, --required |
Require at least one selection |
-h, --help |
Show help |
Prompts for sensitive input with masking.
secret=$(npx -y @inquirer-cli/password -r "Enter your password")| Option | Description |
|---|---|
<message> |
The prompt message (required) |
-r, --required |
Reject empty input |
-h, --help |
Show help |
@inquirer-cli/editor (not supported yet)
@inquirer-cli/editorOpens 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"#!/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- Node.js >= 20.12.0
MIT
@inquirer-cli is an independent project and is not affiliated with or endorsed by Inquirer.js.