From 2539e24fe9eadf69cb20b01d2303a99fa2e8a363 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 8 Mar 2023 17:13:11 +0800 Subject: chore: improve code by getting prompt from config (#39) --- src/config.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 3b24a08..ec897b4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -178,6 +178,13 @@ impl Config { }) } + pub fn merge_prompt(&self, content: &str) -> String { + match self.get_prompt() { + Some(prompt) => format!("{}\n{content}", prompt.trim()), + None => content.to_string(), + } + } + pub fn info(&self) -> Result { let file_info = |path: &Path| { let state = if path.exists() { "" } else { " ⚠️" }; -- cgit v1.2.3