1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use dialoguer::{theme::ColorfulTheme, Input, Password};

use crate::Error;

pub fn input<T>(prompt: T) -> Result<String, Error>
where
    T: AsRef<str>,
{
    Ok(Input::with_theme(&ColorfulTheme::default())
        .with_prompt(prompt.as_ref())
        .interact_text()?)
}

pub fn password<T>(prompt: T) -> Result<String, Error>
where
    T: AsRef<str>,
{
    Ok(Password::with_theme(&ColorfulTheme::default())
        .with_prompt(prompt.as_ref())
        .interact()?)
}