summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index c7ae56e..0f12db5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -45,9 +45,13 @@ fn main() -> Result<()> {
config.borrow_mut().role = role;
let client = ChatGptClient::init(config.clone())?;
if atty::isnt(atty::Stream::Stdin) {
- let mut text = String::new();
- stdin().read_to_string(&mut text)?;
- start_directive(client, config, &text)
+ let mut input = String::new();
+ config.borrow_mut().highlight = false;
+ stdin().read_to_string(&mut input)?;
+ if let Some(text) = text {
+ input = format!("{text}\n{input}");
+ }
+ start_directive(client, config, &input)
} else {
match text {
Some(text) => start_directive(client, config, &text),