Browse Source

feat: add command prompt styles

main
fdai7451 2 years ago
parent
commit
f2f50e20f8
  1. 30
      src/prompt.rs

30
src/prompt.rs

@ -1,11 +1,35 @@
pub struct Prompt;
use std::path::PathBuf;
pub enum PromptStyle {
None,
}
impl PromptStyle {
pub fn fmt_style(&self, path: PathBuf) -> String {
match self {
PromptStyle::None => self.fmt_none(path),
}
}
fn fmt_none(&self, _: PathBuf) -> String {
return "» ".to_string();
}
}
pub struct Prompt {
pub style: PromptStyle,
}
impl Prompt {
pub fn new() -> Self {
Self {}
Self {
style: PromptStyle::None,
}
}
pub fn get_prompt(&mut self) -> String {
format!("» ")
let path = std::env::current_dir().unwrap();
return self.style.fmt_style(path);
}
}
Loading…
Cancel
Save