refactor: `.file` repl command files/text split (#472)

pull/473/head
sigoden 3 weeks ago committed by GitHub
parent c4c948a54c
commit e3116280c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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?;

Loading…
Cancel
Save