From 14062a248912334b7e95b42d14767e32b837b864 Mon Sep 17 00:00:00 2001 From: LeiJuntao <2606542098@qq.com> Date: Sun, 31 May 2026 15:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'project/java-cli/src/main?= =?UTF-8?q?/java/com/example/datacollect/command/SaveCommand.java'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollect/command/SaveCommand.java | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 project/java-cli/src/main/java/com/example/datacollect/command/SaveCommand.java diff --git a/project/java-cli/src/main/java/com/example/datacollect/command/SaveCommand.java b/project/java-cli/src/main/java/com/example/datacollect/command/SaveCommand.java deleted file mode 100644 index f9af5f3..0000000 --- a/project/java-cli/src/main/java/com/example/datacollect/command/SaveCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.example.datacollect.command; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.example.datacollect.repository.ArticleRepository; -import com.example.datacollect.view.ConsoleView; - -public class SaveCommand implements Command { - private static final Logger logger = LoggerFactory.getLogger(SaveCommand.class); - private final ConsoleView view; - - public SaveCommand(ConsoleView view) { - this.view = view; - } - - @Override - public String getName() { - return "save"; - } - - @Override - public void execute(String[] args, ArticleRepository repository) { - String filePath = args.length > 1 ? args[1] : "articles.txt"; - try { - repository.saveToFile(filePath); - view.printSuccess("Saved " + repository.size() + " articles to " + filePath); - } catch (Exception e) { - view.printError("Failed to save: " + e.getMessage()); - logger.error("Failed to save articles to file", e); - } - } -} \ No newline at end of file