diff options
Diffstat (limited to 'src/repl/mod.rs')
| -rw-r--r-- | src/repl/mod.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 48d8224..5b37d36 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -33,7 +33,7 @@ lazy_static! { const MENU_NAME: &str = "completion_menu"; lazy_static! { - static ref REPL_COMMANDS: [ReplCommand; 23] = [ + static ref REPL_COMMANDS: [ReplCommand; 24] = [ ReplCommand::new(".help", "Show this help message", AssertState::pass()), ReplCommand::new(".info", "View system info", AssertState::pass()), ReplCommand::new(".model", "Change the current LLM", AssertState::pass()), @@ -73,6 +73,11 @@ lazy_static! { AssertState::True(StateFlags::SESSION_EMPTY | StateFlags::SESSION) ), ReplCommand::new( + ".edit session", + "Edit the current session", + AssertState::True(StateFlags::SESSION_EMPTY | StateFlags::SESSION) + ), + ReplCommand::new( ".clear messages", "Erase messages in the current session", AssertState::True(StateFlags::SESSION) @@ -279,8 +284,8 @@ Tips: use <tab> to autocomplete conversation starter text. }, ".save" => { match args.map(|v| match v.split_once(' ') { - Some((subcmd, args)) => (subcmd, args.trim()), - None => (v, ""), + Some((subcmd, args)) => (subcmd, Some(args.trim())), + None => (v, None), }) { Some(("session", name)) => { self.config.write().save_session(name)?; @@ -290,6 +295,19 @@ Tips: use <tab> to autocomplete conversation starter text. } } } + ".edit" => { + match args.map(|v| match v.split_once(' ') { + Some((subcmd, args)) => (subcmd, Some(args.trim())), + None => (v, None), + }) { + Some(("session", _)) => { + self.config.write().edit_session()?; + } + _ => { + println!(r#"Usage: .edit session"#) + } + } + } ".set" => match args { Some(args) => { self.config.write().update(args)?; |
