From 0926afe80a626940b90f1f095d6f2ade32ed0865 Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Mon, 23 Jan 2023 00:47:55 +0100 Subject: [PATCH] feat: change prompt style 'None' to 'Default' --- src/builtins/change_prompt.rs | 6 +++--- src/builtins/mod.rs | 2 +- src/prompt.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/builtins/change_prompt.rs b/src/builtins/change_prompt.rs index bab04f5..114831e 100644 --- a/src/builtins/change_prompt.rs +++ b/src/builtins/change_prompt.rs @@ -12,7 +12,7 @@ impl Builtin for ChangePrompt { )) } else if let Some(style) = args.get(0) { match style.to_lowercase().as_str() { - "none" => config.prompt_style = PromptStyle::None, + "default" => config.prompt_style = PromptStyle::Default, "simple-directory" | "simple_directory" | "simpledirectory" => { config.prompt_style = PromptStyle::SimpleDirectory } @@ -61,9 +61,9 @@ mod tests { } #[test] - fn test_change_prompt_none() { + fn test_change_prompt_default() { assert_eq!( - ChangePrompt.execute(&mut BuiltinConfig::new(), vec!["none".to_string()]), + ChangePrompt.execute(&mut BuiltinConfig::new(), vec!["default".to_string()]), Ok(()) ) } diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index b091e95..218f26e 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -13,7 +13,7 @@ pub struct BuiltinConfig { impl BuiltinConfig { pub fn new() -> Self { Self { - prompt_style: PromptStyle::None, + prompt_style: PromptStyle::Default, } } } diff --git a/src/prompt.rs b/src/prompt.rs index 26aa31a..d6fcb64 100644 --- a/src/prompt.rs +++ b/src/prompt.rs @@ -2,7 +2,7 @@ use std::env; #[derive(Clone)] pub enum PromptStyle { - None, + Default, SimpleDirectory, BashLike, } @@ -10,13 +10,13 @@ pub enum PromptStyle { impl PromptStyle { pub fn fmt_style(&self) -> String { match self { - PromptStyle::None => self.fmt_none(), + PromptStyle::Default => self.fmt_default(), PromptStyle::SimpleDirectory => self.fmt_simple_directory(), PromptStyle::BashLike => self.fmt_bash_like(), } } - fn fmt_none(&self) -> String { + fn fmt_default(&self) -> String { "ยป ".to_string() } @@ -54,7 +54,7 @@ pub struct Prompt { impl Prompt { pub fn new() -> Self { Self { - style: PromptStyle::None, + style: PromptStyle::Default, } }