diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 5 | ||||
| -rw-r--r-- | src/config/mod.rs | 2 | ||||
| -rw-r--r-- | src/main.rs | 3 | ||||
| -rw-r--r-- | src/repl/mod.rs | 2 |
4 files changed, 9 insertions, 3 deletions
@@ -15,7 +15,10 @@ pub struct Cli { /// Start or join a session #[clap(short = 's', long)] pub session: Option<Option<String>>, - /// Forces the session to be saved + /// Ensure the session is empty + #[clap(long)] + pub empty_session: bool, + /// Force the session to be saved #[clap(long)] pub save_session: bool, /// Start a agent diff --git a/src/config/mod.rs b/src/config/mod.rs index 97ec014..f8e3672 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1090,7 +1090,7 @@ impl Config { Ok(()) } - pub fn clear_session_messages(&mut self) -> Result<()> { + pub fn empty_session(&mut self) -> Result<()> { if let Some(session) = self.session.as_mut() { session.clear_messages(); if let Some(agent) = self.agent.as_ref() { diff --git a/src/main.rs b/src/main.rs index 299dc6b..b9bb54f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,6 +128,9 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option<String>) -> Result<()> if cli.no_stream { config.write().stream = false; } + if cli.empty_session { + config.write().empty_session()?; + } if cli.save_session { config.write().set_save_session(Some(true)); } diff --git a/src/repl/mod.rs b/src/repl/mod.rs index a7b2573..5a741c2 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -475,7 +475,7 @@ impl Repl { }, ".clear" => match args { Some("messages") => { - self.config.write().clear_session_messages()?; + self.config.write().empty_session()?; } _ => unknown_command()?, }, |
