pipr 0.1.0

A commandline-utility to interactively build complex shell pipelines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub struct KeySelectMenu<T> {
    options: Vec<(char, String)>,
    pub menu_type: T,
}

impl<T> KeySelectMenu<T> {
    pub fn new(options: Vec<(char, String)>, menu_type: T) -> Self {
        Self { options, menu_type }
    }

    pub fn option_list_strings(&self) -> impl Iterator<Item = String> + '_ {
        self.options.iter().map(|(c, s)| format!("{}: {}", c, s))
    }
}