Home

Awesome

Requestty

RustCI RustCI RustCI Crates.io License Documentation

requestty (request-tty) is an easy-to-use collection of interactive cli prompts inspired by Inquirer.js.

Usage

Add this to your Cargo.toml

[dependencies]
requestty = "0.4.1"

To ask a question:

let question = requestty::Question::expand("overwrite")
    .message("Conflict on `file.rs`")
    .choices(vec![
        ('y', "Overwrite"),
        ('a', "Overwrite this one and all next"),
        ('d', "Show diff"),
    ])
    .default_separator()
    .choice('x', "Abort")
    .build();

println!("{:#?}", requestty::prompt_one(question));

More examples are available in the documentation and the examples directory.

In-built prompts

There are 11 in-built prompts:

Optional features

Minimum Supported Rust Version (MSRV)

Minimum supported rust version (as per cargo-msrv) is 1.56.1