use anyhow::{Error, Result};
use dialoguer::{theme::ColorfulTheme, Confirm, Input, Password};
pub fn confirm(prompt: &str, default: bool) -> Result<bool> {
Confirm::with_theme(&ColorfulTheme::default())
.with_prompt(prompt)
.wait_for_newline(true)
.default(default)
.interact()
.map_err(Error::msg)
}
pub fn set_password(prompt: &str) -> Result<String> {
Password::with_theme(&ColorfulTheme::default())
.with_prompt(prompt)
.with_confirmation("Confirm password", "Passwords do not match")
.interact()
.map_err(Error::msg)
}
pub fn read_password() -> Result<String> {
Password::with_theme(&ColorfulTheme::default())
.with_prompt("Enter master password")
.report(false)
.interact()
.map_err(Error::msg)
}
pub fn input(prompt: &str) -> Result<String> {
Input::with_theme(&ColorfulTheme::default())
.with_prompt(prompt)
.interact()
.map_err(Error::msg)
}