Getting started
Get started with Enquirer, the most powerful command line utility for creating interactive CLI prompts.
Install
enquirer
is available on Linux, macOS
With Homebrew
$ brew tap termapps/tap
$ brew install enquirer
This is recommended way for installation on macOS since updating to the new version is easy.
With cargo
$ cargo install enquirer
Direct
Pre-built binary executables are available at releases page for macOS (64bit), Linux (64bit, 32bit).
Download and unarchive the binary then put the executable in $PATH
.
Usage
Command Line Utility
The main reason I created this tool is to use it as an stylish interactive and user-friendly prompt for bash scripting.
#!/bin/bash
TRUE="true"
CONFIRM=
if [; then
else
fi
See prompts for more information on subcommands.
enquirer 0.2.0
Command Line Utility for Stylish Interactive Prompts
USAGE:
enquirer [FLAGS] <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
--no-color Disable colors in the prompt
-V, --version Prints version information
SUBCOMMANDS:
confirm Prompt that returns `true` or `false`
help Prints this message or the help of the given subcommand(s)
input Prompt that takes user input and returns a string
secret Prompt that takes user input, hides it from the terminal, and returns a string
Library
If you want the dialoguer theme used in this tool you can add this package to your Cargo.toml
use Confirmation;
use ColoredTheme;
Prompts
Confirm Prompt
Prompt that returns true
or false
(as strings).
Usage
enquirer-confirm 0.2.0
Prompt that returns `true` or `false`
USAGE:
enquirer confirm [FLAGS] [OPTIONS] --message <message>
FLAGS:
-d, --default Default value for the prompt is `true`
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-m, --message <message> Message for the prompt
Input Prompt
Prompt that takes user input and returns a string.
Usage
enquirer-input 0.2.0
Prompt that takes user input and returns a string
USAGE:
enquirer input [FLAGS] [OPTIONS] --message <message>
FLAGS:
-a, --allow-empty Allow empty input. Conflicts with `default`
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-d, --default <default> Default value for the prompt
-m, --message <message> Message for the prompt
Secret Prompt
Prompt that takes user input, hides it from the terminal, and returns a string
Usage
enquirer-secret 0.2.0
Prompt that takes user input, hides it from the terminal, and returns a string
USAGE:
enquirer secret [FLAGS] [OPTIONS] --message <message>
FLAGS:
-a, --allow-empty Allow empty secret
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --confirm <confirm> Enable confirmation prompt with this message
-e, --error <error> Error message when secrets doesn't match during confirmation
-m, --message <message> Message for the prompt
About
Changelog
Please see CHANGELOG.md.
License
MIT/X11
Bug Reports
Report here.
Creator
Pavan Kumar Sunkara (pavan.sss1991@gmail.com)