From c3f9ef6c396ba692e82cdfaa929429c85eebd289 Mon Sep 17 00:00:00 2001 From: Leo Bergnéhr Date: Thu, 26 Oct 2023 13:25:53 +0200 Subject: feat: add .read command (#145) --- src/repl/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/repl/mod.rs') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 311ca72..7c99757 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -17,7 +17,7 @@ use anyhow::{Context, Result}; use reedline::Signal; use std::rc::Rc; -pub const REPL_COMMANDS: [(&str, &str); 13] = [ +pub const REPL_COMMANDS: [(&str, &str); 14] = [ (".info", "Print system-wide information"), (".set", "Modify the configuration temporarily"), (".model", "Choose a model"), @@ -31,6 +31,7 @@ pub const REPL_COMMANDS: [(&str, &str); 13] = [ (".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 { @@ -118,6 +119,10 @@ impl Repl { Some(name) => handler.handle(ReplCmd::SetRole(name.to_string()))?, None => print_now!("Usage: .role \n\n"), }, + ".read" => match args { + Some(file) => handler.handle(ReplCmd::ReadFile(file.to_string()))?, + None => print_now!("Usage: .read \n\n"), + }, ".info" => { handler.handle(ReplCmd::ViewInfo)?; } -- cgit v1.2.3