You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
|
|
package com.crawler;
|
|
|
|
import com.crawler.command.Command;
|
|
import com.crawler.command.CrawlCommand;
|
|
import com.crawler.controller.CrawlerController;
|
|
import com.crawler.view.ConsoleView;
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class App {
|
|
public static void main(String[] args) {
|
|
ConsoleView view = new ConsoleView();
|
|
CrawlerController controller = new CrawlerController(view);
|
|
Command crawlCommand = new CrawlCommand(controller);
|
|
|
|
view.showWelcome();
|
|
|
|
Scanner scanner = new Scanner(System.in);
|
|
boolean running = true;
|
|
|
|
while (running) {
|
|
view.showMenu();
|
|
String input = scanner.nextLine().trim();
|
|
|
|
switch (input) {
|
|
case "1":
|
|
crawlCommand.execute();
|
|
break;
|
|
case "2":
|
|
running = false;
|
|
view.showMessage("程序退出");
|
|
break;
|
|
default:
|
|
view.showError("无效选项,请重新输入");
|
|
}
|
|
}
|
|
|
|
scanner.close();
|
|
}
|
|
}
|
|
|