From ec469cff3ba23b6035aebc74fa7de7b82e678a56 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 6 Jan 2025 08:18:33 +0800 Subject: feat: `.file` supports external command execution (#1075) --- src/repl/mod.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/repl') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 868325e..0089f9a 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -148,7 +148,7 @@ lazy_static::lazy_static! { ), ReplCommand::new( ".file", - "Include files with the message", + "Include files, directories, URLs or commands", AssertState::pass() ), ReplCommand::new(".continue", "Continue the response", AssertState::pass()), @@ -412,7 +412,15 @@ impl Repl { .await?; ask(&self.config, self.abort_signal.clone(), input, true).await?; } - None => println!("Usage: .file ... [-- ...]"), + None => println!( + r#"Usage: .file ... [-- ...] + +.file /tmp/file.txt +.file src/ Cargo.toml -- analyze +.file https://example.com/file.txt -- summarize +.file https://example.com/image.png -- recongize text +.file `git diff` -- Generate git commit message"# + ), }, ".continue" => { let (mut input, output) = match self.config.read().last_message.clone() { @@ -736,7 +744,7 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec, &str) { word.clear(); } } - '\'' | '"' => { + '\'' | '"' | '`' => { word.push(char); unbalance = Some(char); } -- cgit v1.2.3