Rename prompts and stuff to ame prompt

Signed-off-by: trivernis <trivernis@protonmail.com>
i18n
trivernis 2 years ago
parent 8b2a62969e
commit 0f3133bf16
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -2,13 +2,13 @@
/// Macro for prompting the user with a yes/no question.
macro_rules! prompt {
(default yes, $($arg:tt)+) => {
$crate::interact::Interact::interact($crate::interact::Prompt::new(format!($($arg)+)).default_yes())
$crate::interact::Interact::interact($crate::interact::AmePrompt::new(format!($($arg)+)).default_yes())
};
(default no, $($arg:tt)+) => {
$crate::interact::Interact::interact($crate::interact::Prompt::new(format!($($arg)+)).default_no())
$crate::interact::Interact::interact($crate::interact::AmePrompt::new(format!($($arg)+)).default_no())
};
(no default, $($arg:tt)+) => {
$crate::interact::Interact::interact($crate::interact::Prompt::new(format!($($arg)+)))
$crate::interact::Interact::interact($crate::interact::AmePrompt::new(format!($($arg)+)))
}
}
@ -16,6 +16,6 @@ macro_rules! prompt {
/// Macro for prompting the user with a multi select
macro_rules! multi_select {
($items:expr, $($arg:tt)+) => {
$crate::interact::Interact::interact($crate::interact::MultiSelect::new(format!($($arg)+)).items($items))
$crate::interact::Interact::interact($crate::interact::AmeMultiSelect::new(format!($($arg)+)).items($items))
}
}

@ -3,8 +3,8 @@ mod multi_select;
mod prompt;
mod theme;
pub use multi_select::MultiSelect;
pub use prompt::Prompt;
pub use multi_select::AmeMultiSelect;
pub use prompt::AmePrompt;
pub trait Interact {
type Result;

@ -4,12 +4,12 @@ use crate::logging::get_logger;
use super::{theme::AmeTheme, Interact};
pub struct MultiSelect {
pub struct AmeMultiSelect {
prompt: String,
items: Vec<String>,
}
impl MultiSelect {
impl AmeMultiSelect {
/// Creates a new multi select prompt
pub fn new<S: ToString>(prompt: S) -> Self {
Self {
@ -26,7 +26,7 @@ impl MultiSelect {
}
}
impl Interact for MultiSelect {
impl Interact for AmeMultiSelect {
type Result = Vec<usize>;
fn interact(&mut self) -> Self::Result {

@ -4,12 +4,12 @@ use crate::logging::get_logger;
use super::{theme::AmeTheme, Interact};
pub struct Prompt {
pub struct AmePrompt {
question: String,
default_yes: Option<bool>,
}
impl Prompt {
impl AmePrompt {
/// Creates a new prompt
pub fn new<Q: ToString>(question: Q) -> Self {
Self {
@ -33,7 +33,7 @@ impl Prompt {
}
}
impl Interact for Prompt {
impl Interact for AmePrompt {
type Result = bool;
fn interact(&mut self) -> Self::Result {

Loading…
Cancel
Save