1.0.6 • Published 7 months ago
@inquirer-cli/confirm v1.0.6
@inquirer-cli/confirm
CLI tool for yes/no confirmation using Inquirer.js.
Installation
No installation required. Use npx to run the tool directly:
npx -y @inquirer-cli/confirm [...options]Note: The
-yflag is used withnpxto skip the installation prompt. This is necessary because the CLI's output is consumed by$()in bash, which would otherwise cause the script to freeze.
Usage
Prompt the user for confirmation:
if $(npx -y @inquirer-cli/confirm "Do you want to continue?"); then
echo "Proceeding..."
else
echo "Operation cancelled."
fiOptions
<message>(required): The message to display to the user.-y, --yes: Set the default answer to "yes" (default: "no").-h, --help: Show the help message and exit.
Example
#!/bin/sh
if $(npx -y @inquirer-cli/confirm "Do you want to continue?"); then
echo "Proceeding..."
else
echo "Operation cancelled."
fiLicense
MIT