Crates.io

Trompt

Prompt your users with style

Documentation

Trompt aims to be a fully featured simple to use prompting libarary for rust.

To get started add…

toml [dependencies] trompt = "0.0.2"

…to your Cargo.toml, and…

rust extern crate trompt;

…at the top level of your crate.

From now on you can prompt your users using the trompt::Trompt struct.

Example

```rust extern crate trompt;

use trompt::Trompt;

fn main() { let std::io::stdin = stdin(); let mut input = stdin.lock(); let mut output = std::io::stdout();

let username = Trompt::new(&mut input, &mut output).prompt("Username: ");
let password = Trompt::new(&mut input, &mut output).silent(true).prompt("Password: ");
let confirmed = Trompt::new(&mut input, &mut output).prompt("Are you sure [yn]? ");

println!(
    "{}:{}, {}",
    username.unwrap(),
    password.unwrap(),
    if confirmed.unwrap() { "is sure" } else { "is unsure" },
);

} ```