refactor: improve code quanity

This commit is contained in:
sigoden 2023-10-26 19:28:57 +08:00
parent c3f9ef6c39
commit b3f8f27018
2 changed files with 3 additions and 2 deletions

View File

@ -111,7 +111,8 @@ impl ReplCmdHandler {
ReplCmd::ReadFile(file) => {
let mut contents = String::new();
let mut file = fs::File::open(file).expect("Unable to open file");
file.read_to_string(&mut contents).expect("Unable to read file");
file.read_to_string(&mut contents)
.expect("Unable to read file");
self.handle(ReplCmd::Submit(contents))?;
}
}

View File

@ -27,11 +27,11 @@ pub const REPL_COMMANDS: [(&str, &str); 14] = [
(".conversation", "Start a conversation."),
(".clear conversation", "End current conversation."),
(".copy", "Copy the last output to the clipboard"),
(".read", "Read the contents of a file into the prompt"),
(".history", "Print the history"),
(".clear history", "Clear the history"),
(".help", "Print this help message"),
(".exit", "Exit the REPL"),
(".read", "Read the contents of a file into the prompt"),
];
impl Repl {