1 changed files with 0 additions and 33 deletions
@ -1,33 +0,0 @@ |
|||||
package com.example.datacollect.model; |
|
||||
|
|
||||
import com.example.datacollect.command.Command; |
|
||||
import com.example.datacollect.view.ConsoleView; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public class HistoryCommand implements Command { |
|
||||
private final ConsoleView view; |
|
||||
private final List<String> commandHistory; |
|
||||
|
|
||||
public HistoryCommand(ConsoleView view, List<String> commandHistory) { |
|
||||
this.view = view; |
|
||||
this.commandHistory = commandHistory; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public String getName() { |
|
||||
return "history"; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void execute(String[] args, List<Article> articles) { |
|
||||
if (commandHistory.isEmpty()) { |
|
||||
view.printInfo("暂无命令历史记录"); |
|
||||
return; |
|
||||
} |
|
||||
view.printInfo("命令历史记录:"); |
|
||||
for (int i = 0; i < commandHistory.size(); i++) { |
|
||||
System.out.println((i + 1) + ". " + commandHistory.get(i)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue