package com.example.datacollect; import com.example.datacollect.command.HistoryCommand; import com.example.datacollect.controller.CrawlerController; import com.example.datacollect.model.Article; import com.example.datacollect.view.ConsoleView; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { ConsoleView view = new ConsoleView(); List
articles = new ArrayList<>(); HistoryCommand historyCommand = new HistoryCommand(); CrawlerController controller = new CrawlerController(view, articles, historyCommand); view.printSuccess("Welcome to CLI Crawler (w9_1)! Type help for commands."); while (true) { String input = view.readLine(); historyCommand.record(input); // 记录用户输入的命令 controller.handle(input); } } }