promptt
promptt is a lightweight, interactive CLI prompts library for Rust. It supports text, confirm, number, select, toggle, list, password, and invisible inputs—ideal for building terminal wizards, config generators, or any step-by-step CLI flow.
Installation
Add this crate with Cargo:
Usage
Define a list of Questions (each with a name, type_name, and message), then run them with prompt(). Answers are returned as a HashMap<String, PromptValue>.
use ;
use ;
Supported prompt types
| Type | Result | Notes |
|---|---|---|
text |
PromptValue::String |
Single-line input |
password |
PromptValue::String |
Input hidden (masked) |
invisible |
PromptValue::String |
Input hidden (no echo) |
number |
PromptValue::Float |
Use min/max, float, round on Question |
confirm |
PromptValue::Bool |
Yes/No; set initial_bool for default |
toggle |
PromptValue::Bool |
Use active/inactive for labels |
select |
PromptValue::String |
Single choice from choices |
list |
PromptValue::List |
Multiple choices; use separator on Question |
Contribution
- Clone this repository
- Install the latest version of Rust
- Run tests using
cargo testorcargo run
Credits
promptt has been inspired by several outstanding projects in the community:
- @prompts - Lightweight, beautiful and user-friendly interactive prompts