lacy 0.7.1

Fast magical cd alternative for lazy terminal navigators
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use dialoguer::{theme::ColorfulTheme, Select};

pub fn select(title: &str, options: &Vec<String>) -> Option<String> {
    if let Some(selection) = Select::with_theme(&ColorfulTheme::default())
        .with_prompt(title)
        .items(options)
        .default(0)
        .interact_opt()
        .ok()
        .flatten()
    {
        return Some(options[selection].clone());
    }
    None
}