package com.example.datacollect.command; import com.example.datacollect.repository.ArticleRepository; import com.example.datacollect.view.ConsoleView; import java.util.List; public class HistoryCommand implements Command { private final ConsoleView view; private final List commandHistory; public HistoryCommand(ConsoleView view, List commandHistory) { this.view = view; this.commandHistory = commandHistory; } @Override public String getName() { return "history"; } @Override public void execute(String[] args, ArticleRepository repository) { if (commandHistory.isEmpty()) { view.printInfo("No command history."); return; } view.printInfo("Command history:"); for (int i = 0; i < commandHistory.size(); i++) { view.printInfo((i + 1) + ". " + commandHistory.get(i)); } } }