4 releases

Uses old Rust 2015

0.0.4 Mar 6, 2017
0.0.3 Jan 17, 2017
0.0.2 Jan 16, 2017
0.0.1 Jan 15, 2017

#1081 in Authentication


Used in crypto-wallet-gen

MIT license

23KB
367 lines

Crates.io build status

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…

[dependencies]
trompt = "0.0.4"

…to your Cargo.toml, and…

extern crate trompt;

…at the top level of your crate.

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

Example

extern crate trompt;

use trompt::Trompt;

fn main() {
    let usr = Trompt::stdout()
        .required()
        .prompt("Username: ");

    let pwd = Trompt::stdout()
        .silent()
        .min_len(8)
        .prompt("Password: ");

    let is_sure = Trompt::stdout()
        .confirm("Are you sure [yn]? ");

    println!(
        "{}:{}, {}",
        usr.unwrap(),
        pwd.unwrap(),
        if is_sure.unwrap() { "is sure" } else { "is unsure" },
    );
}

Dependencies

~120KB