easy_input_tools/ascii/checkbox.rs
1use std::collections::HashSet;
2use std::io::Result;
3
4
5pub fn checkbox(options: &Vec<&str>) -> Result<HashSet<usize>> {
6 crate::custom::checkbox(
7 options,
8 |option, i, selected, selection| {
9 format!(
10 "{}{}{} {}",
11 if i == selected { ">" } else { "[" },
12 if selection.contains(&i) { "x" } else { " " },
13 if i == selected { "<" } else { "]" },
14 option,
15 ).into()
16 },
17 )
18}