From 6ce61592d9b4700bbe20685bf85562b094c25f4e Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 2 Oct 2024 08:45:24 +0800 Subject: feat: change prompt for choosing shell command actions (#898) --- src/utils/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/utils') diff --git a/src/utils/mod.rs b/src/utils/mod.rs index e937e6b..81ae0ff 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -137,15 +137,16 @@ pub fn pretty_error(err: &anyhow::Error) -> String { } pub fn error_text(input: &str) -> String { - nu_ansi_term::Style::new() - .fg(nu_ansi_term::Color::Red) - .paint(input) - .to_string() + color_text(input, nu_ansi_term::Color::Red) } pub fn warning_text(input: &str) -> String { + color_text(input, nu_ansi_term::Color::Yellow) +} + +pub fn color_text(input: &str, color: nu_ansi_term::Color) -> String { nu_ansi_term::Style::new() - .fg(nu_ansi_term::Color::Yellow) + .fg(color) .paint(input) .to_string() } -- cgit v1.2.3