diff options
Diffstat (limited to 'src/repl/mod.rs')
| -rw-r--r-- | src/repl/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 661be75..9d7d1cf 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -1,10 +1,12 @@ mod abort; mod handler; mod init; +mod prompt; pub use self::abort::*; pub use self::handler::*; pub use self::init::Repl; +use self::prompt::ReplPrompt; use crate::client::ChatGptClient; use crate::config::SharedConfig; @@ -33,7 +35,8 @@ pub const REPL_COMMANDS: [(&str, &str, bool); 12] = [ impl Repl { pub fn run(&mut self, client: ChatGptClient, config: SharedConfig) -> Result<()> { let abort = AbortSignal::new(); - let handler = ReplCmdHandler::init(client, config, abort.clone())?; + let handler = ReplCmdHandler::init(client, config.clone(), abort.clone())?; + let prompt = ReplPrompt::new(config); print_now!("Welcome to aichat {}\n", env!("CARGO_PKG_VERSION")); print_now!("Type \".help\" for more information.\n"); let mut already_ctrlc = false; @@ -45,7 +48,7 @@ impl Repl { if abort.aborted_ctrlc() && !already_ctrlc { already_ctrlc = true; } - let sig = self.editor.read_line(&self.prompt); + let sig = self.editor.read_line(&prompt); match sig { Ok(Signal::Success(line)) => { already_ctrlc = false; |
