added reset at the end of the prompt

This commit is contained in:
MasterGordon 2024-08-19 23:12:22 +02:00
parent 1ed10e9a06
commit a63d404c26
4 changed files with 7 additions and 4 deletions

2
Cargo.lock generated
View File

@ -35,7 +35,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]] [[package]]
name = "fast-git-prompt" name = "fast-git-prompt"
version = "0.2.1" version = "0.2.2"
dependencies = [ dependencies = [
"git2", "git2",
"regex", "regex",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "fast-git-prompt" name = "fast-git-prompt"
version = "0.2.1" version = "0.2.2"
description = "A fast git prompt for zsh and bash." description = "A fast git prompt for zsh and bash."
license = "MIT" license = "MIT"
repository = "https://github.com/MasterGordon/fast-git-prompt" repository = "https://github.com/MasterGordon/fast-git-prompt"

View File

@ -20,6 +20,7 @@ pub enum Color {
BrightMagenta, BrightMagenta,
BrightCyan, BrightCyan,
BrightWhite, BrightWhite,
Reset,
} }
const ESC: &str = "\x1b"; const ESC: &str = "\x1b";
@ -54,6 +55,7 @@ impl Ansi for Color {
Color::BrightMagenta => format!("{}[95m", ESC), Color::BrightMagenta => format!("{}[95m", ESC),
Color::BrightCyan => format!("{}[96m", ESC), Color::BrightCyan => format!("{}[96m", ESC),
Color::BrightWhite => format!("{}[97m", ESC), Color::BrightWhite => format!("{}[97m", ESC),
Color::Reset => format!("{}[0m", ESC),
} }
} }
} }

View File

@ -136,8 +136,9 @@ fn main() {
prompt = prompt.drain(..).filter(|s| !s.is_empty()).collect(); prompt = prompt.drain(..).filter(|s| !s.is_empty()).collect();
print!( print!(
"{}{}", "{}{}{}",
color(config.base_color), color(config.base_color),
prompt.join(format!("{} ", color(config.base_color)).as_str()) prompt.join(format!("{} ", color(config.base_color)).as_str()),
color(Some(Color::Reset))
); );
} }