diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-01 16:00:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 16:00:48 +0800 |
| commit | e3116280c6e1e2a74b483df09723ceee55ae704c (patch) | |
| tree | 5bc5a7d1f015c5b3040d48c224d806fe2b3aef49 /src | |
| parent | c4c948a54ca84a95986ddf29384c7f057248f42a (diff) | |
| download | aichat-e3116280c6e1e2a74b483df09723ceee55ae704c.tar.gz | |
refactor: `.file` repl command files/text split (#472)
Diffstat (limited to 'src')
| -rw-r--r-- | src/repl/mod.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 4c50c2f..29b4a43 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -212,10 +212,11 @@ impl Repl { } ".file" => match args { Some(args) => { - let (files, text) = match args.split_once(" -- ") { - Some((files, text)) => (files.trim(), text.trim()), - None => (args, ""), - }; + let (files, text) = + match args.split_once(" -- ").or_else(|| args.split_once(" --\n")) { + Some((files, text)) => (files.trim(), text.trim()), + None => (args, ""), + }; let files = shell_words::split(files).with_context(|| "Invalid args")?; let input = Input::new(text, files, self.config.read().input_context())?; self.ask(input).await?; |
