From b3f8f27018b1bbb3c1eb59ef05acc2d2a420b45e Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 26 Oct 2023 19:28:57 +0800 Subject: refactor: improve code quanity --- src/repl/handler.rs | 3 ++- src/repl/mod.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/repl/handler.rs b/src/repl/handler.rs index 45836ba..a061742 100644 --- a/src/repl/handler.rs +++ b/src/repl/handler.rs @@ -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))?; } } diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 7c99757..ecb58d0 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -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 { -- cgit v1.2.3