summaryrefslogtreecommitdiffstats
path: root/src/repl
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-01-06 08:18:33 +0800
committerGitHub <noreply@github.com>2025-01-06 08:18:33 +0800
commitec469cff3ba23b6035aebc74fa7de7b82e678a56 (patch)
treec7f730a64246a6fd327f4851f178b659cf1710d9 /src/repl
parentbb648d68845e0755edb03570237039433a752463 (diff)
downloadaichat-ec469cff3ba23b6035aebc74fa7de7b82e678a56.tar.gz
feat: `.file` supports external command execution (#1075)
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/mod.rs14
1 files changed, 11 insertions, 3 deletions
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 <files>... [-- <text>...]"),
+ None => println!(
+ r#"Usage: .file <file|dir|url|cmd>... [-- <text>...]
+
+.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<String>, &str) {
word.clear();
}
}
- '\'' | '"' => {
+ '\'' | '"' | '`' => {
word.push(char);
unbalance = Some(char);
}