summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-10-02 08:45:24 +0800
committerGitHub <noreply@github.com>2024-10-02 08:45:24 +0800
commit6ce61592d9b4700bbe20685bf85562b094c25f4e (patch)
tree62e8af2ffabb2b7b0dc84265542d176433b05300 /src/utils
parentd9e68409726d4a0da7792db6fed778f28026585a (diff)
downloadaichat-6ce61592d9b4700bbe20685bf85562b094c25f4e.tar.gz
feat: change prompt for choosing shell command actions (#898)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mod.rs11
1 files changed, 6 insertions, 5 deletions
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()
}