ztl-cli 0.1.0

Interactive cli for running scripts from Package.json
1
2
3
4
5
6
7
8
9
10
11
12
use dialoguer::Select;
use crate::error::ZtlError;

pub fn select_script(scripts: &[String]) -> Result<String, ZtlError> {
    let selection: usize = Select::new()
        .with_prompt("Select a script to run")
        .items(scripts)
        .default(0)
        .interact()?;

    Ok(scripts[selection].clone())
}