diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-17 19:54:24 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-17 19:54:24 +0800 |
| commit | b965c63be05c726c996ece298d6f5f2514a19316 (patch) | |
| tree | decc1e021caa638de171e0fb94e6e4f5b3e39f63 /src/config/session.rs | |
| parent | 62b297e8bb09e257a61154afddc4017e48bd12f3 (diff) | |
| download | aichat-b965c63be05c726c996ece298d6f5f2514a19316.tar.gz | |
refactor: minor improvement (#611)
Diffstat (limited to 'src/config/session.rs')
| -rw-r--r-- | src/config/session.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/config/session.rs b/src/config/session.rs index 2149ba5..726249c 100644 --- a/src/config/session.rs +++ b/src/config/session.rs @@ -312,12 +312,12 @@ impl Session { } } let session_path = session_dir.join(format!("{}.yaml", self.name())); - self.save(&session_path)?; + self.save(&session_path, is_repl)?; } Ok(()) } - pub fn save(&mut self, session_path: &Path) -> Result<()> { + pub fn save(&mut self, session_path: &Path, is_repl: bool) -> Result<()> { if let Some(sessions_dir) = session_path.parent() { if !sessions_dir.exists() { create_dir_all(sessions_dir).with_context(|| { @@ -338,7 +338,9 @@ impl Session { ) })?; - println!("✨ Saved session to '{}'", session_path.display()); + if is_repl { + println!("✨ Saved session to '{}'", session_path.display()); + } self.dirty = false; |
