novel-api 0.19.1

Novel APIs from various sources
Documentation
use dialoguer::theme::ColorfulTheme;
use dialoguer::{Confirm, 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()?)
}

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