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 for prompting the user with a yes/no question.
macro_rules! prompt { macro_rules! prompt {
(default yes, $($arg:tt)+) => { (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)+) => { (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)+) => { (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 for prompting the user with a multi select
macro_rules! multi_select { macro_rules! multi_select {
($items:expr, $($arg:tt)+) => { ($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 prompt;
mod theme; mod theme;
pub use multi_select::MultiSelect; pub use multi_select::AmeMultiSelect;
pub use prompt::Prompt; pub use prompt::AmePrompt;
pub trait Interact { pub trait Interact {
type Result; type Result;

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

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

Loading…
Cancel
Save