Browse Source

删除 'project/java-cli/src/main/java/com/example/datacollect/command/HistoryCommand.java'

main
LeiJuntao 3 weeks ago
parent
commit
7cd2774cb2
  1. 38
      project/java-cli/src/main/java/com/example/datacollect/command/HistoryCommand.java

38
project/java-cli/src/main/java/com/example/datacollect/command/HistoryCommand.java

@ -1,38 +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;
import java.util.List;
public class HistoryCommand implements Command {
private static final Logger logger = LoggerFactory.getLogger(HistoryCommand.class);
private final ConsoleView view;
private final List<String> history;
public HistoryCommand(ConsoleView view, List<String> history) {
this.view = view;
this.history = history;
}
@Override
public String getName() {
return "history";
}
@Override
public void execute(String[] args, ArticleRepository repository) {
logger.debug("Displaying command history with {} entries", history.size());
if (history.isEmpty()) {
view.printInfo("No command history.");
return;
}
for (int i = 0; i < history.size(); i++) {
System.out.println((i + 1) + ". " + history.get(i));
}
}
}
Loading…
Cancel
Save