mirror of
https://github.com/sigoden/aichat
synced 2024-11-16 06:15:26 +00:00
refactor: improve code quanity
This commit is contained in:
parent
c3f9ef6c39
commit
b3f8f27018
@ -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))?;
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user