Closed dvdsk closed 7 months ago
@dvdsk Thank you for your proposal! I'm considering incorporating it into the changes for v0.3.1, as it's not a difficult modification.
@dvdsk Thank you for your proposal! I'm considering incorporating it into the changes for v0.3.1, as it's not a difficult modification.
Thats great! I'll work off that branch (and master) no need to rush 0.3.1
Feel free to close the issue :)
@dvdsk I added Checkbox::new_with_checked
at https://github.com/ynqa/promkit/tree/dev-0.3.1/main.
It can be executed as follows:
use promkit::{preset::checkbox::Checkbox, Result};
fn main() -> Result {
let mut p = Checkbox::new_with_checked(vec![
("Apple", true),
("Banana", false),
("Orange", true),
("Mango", false),
("Strawberry", false),
("Pineapple", false),
("Grape", false),
("Watermelon", false),
("Kiwi", false),
("Pear", true),
])
.title("What are your favorite fruits?")
.checkbox_lines(5)
.prompt()?;
println!("result: {:?}", p.run()?);
Ok(())
}
Great! thanks a lot!
Nice project! I would love to use it (it looks stunning!). However for my use case I want to run the checkbox prompt with some items pre-selected. I think this is common enough to fit the checkbox preset.
existing work: dialoguer has MultiSelect::items_checked.