Skip to main content

Module group

Module group 

Source
Expand description

Sequentially-chained prompts — ports @clack/prompts group().

Each step is a closure that receives the map of results so far. The whole group bails out on the first cancellation unless on_cancel returns true.

§Example

use cli_ui::prompt::{group, text, confirm};

let answers = group()
    .step("name",   |_| Ok(text("Your name").run()?))
    .step("public", |_| Ok(confirm("Make profile public?").run()?.to_string()))
    .run()
    .unwrap();

println!("{:?}", answers.get("name"));

Structs§

GroupBuilder

Functions§

group