Skip to content

Commit

Permalink
Change ExitCommand to close the application
Browse files Browse the repository at this point in the history
  • Loading branch information
Goh-Li-Ting committed Sep 22, 2023
1 parent d2817e4 commit f2c5b00
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/chatbuddy/command/ExitCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import chatbuddy.TaskList;
import chatbuddy.storage.Storage;
import chatbuddy.ui.Ui;
import javafx.application.Platform;

/** ExitCommand represents a command to exit the chatbot. */
public class ExitCommand extends Command {
Expand All @@ -13,6 +14,7 @@ public class ExitCommand extends Command {
@Override
public String execute(TaskList tasks, Ui ui, Storage storage) throws ChatBuddyException {
storage.save(tasks);
Platform.exit();
return ui.showExit();
}
}

0 comments on commit f2c5b00

Please sign in to comment.