package com.cctv.news; import com.cctv.news.command.*; import com.cctv.news.controller.CommandController; import com.cctv.news.view.ConsoleView; import com.cctv.news.view.OutputView; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { OutputView view = new ConsoleView(); List articles = new ArrayList<>(); CommandController controller = new CommandController(view); controller.registerCommand(new HelpCommand(view)); controller.registerCommand(new ListCommand(view, articles)); controller.registerCommand(new CrawlCommand(view, articles)); controller.registerCommand(new ExitCommand(view)); view.showWelcome(); view.showMessage("输入 help 查看可用命令"); Scanner scanner = new Scanner(System.in); while (true) { view.showPrompt(); String input = scanner.nextLine(); controller.executeCommand(input); } } }