From e3116280c6e1e2a74b483df09723ceee55ae704c Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 1 May 2024 16:00:48 +0800 Subject: [PATCH] refactor: `.file` repl command files/text split (#472) --- src/repl/mod.rs | 9 +++++---- 1 file 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?;