Skip to content

Commit 52476f8

Browse files
authored
fix: not being able to quit with slash command (#276)
1 parent 6da4a8e commit 52476f8

File tree

1 file changed

+11
-7
lines changed
  • crates/chat-cli/src/cli/chat

1 file changed

+11
-7
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,13 +1223,17 @@ impl ChatSession {
12231223
args.insert(0, "q".to_owned());
12241224
match SlashCommand::try_parse_from(args) {
12251225
Ok(command) => {
1226-
if let Err(err) = command.execute(ctx, database, telemetry, self).await {
1227-
queue!(
1228-
self.output,
1229-
style::SetForegroundColor(Color::Red),
1230-
style::Print(format!("Failed to execute command: {}\n", err)),
1231-
style::SetForegroundColor(Color::Reset)
1232-
)?;
1226+
match command.execute(ctx, database, telemetry, self).await {
1227+
Ok(chat_state) if matches!(chat_state, ChatState::Exit) => return Ok(chat_state),
1228+
Err(err) => {
1229+
queue!(
1230+
self.output,
1231+
style::SetForegroundColor(Color::Red),
1232+
style::Print(format!("Failed to execute command: {}\n", err)),
1233+
style::SetForegroundColor(Color::Reset)
1234+
)?;
1235+
},
1236+
_ => {},
12331237
}
12341238

12351239
writeln!(self.output)?;

0 commit comments

Comments
 (0)