1 changed files with 0 additions and 41 deletions
@ -1,41 +0,0 @@ |
|||||
package project; |
|
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.Map; |
|
||||
import java.util.Scanner; |
|
||||
import project.command.*; |
|
||||
import project.controller.CrawlController; |
|
||||
import project.view.CliView; |
|
||||
|
|
||||
public class Main { |
|
||||
private static boolean running = true; |
|
||||
|
|
||||
public static void main(String[] args) { |
|
||||
CliView view = new CliView(); |
|
||||
CrawlController controller = new CrawlController(); |
|
||||
|
|
||||
Map<String, Command> commands = new HashMap<>(); |
|
||||
commands.put("crawl", new CrawlCommand(controller, view)); |
|
||||
commands.put("help", new HelpCommand(commands)); |
|
||||
commands.put("exit", new ExitCommand(() -> running = false)); |
|
||||
|
|
||||
CommandExecutor executor = new CommandExecutor(commands, view); |
|
||||
|
|
||||
if (args.length > 0) { |
|
||||
String input = String.join(" ", args); |
|
||||
executor.execute(input); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
view.printBanner(); |
|
||||
view.printHelp(commands); |
|
||||
|
|
||||
Scanner scanner = new Scanner(System.in); |
|
||||
while (running) { |
|
||||
view.printPrompt(); |
|
||||
String input = scanner.nextLine(); |
|
||||
executor.execute(input); |
|
||||
} |
|
||||
scanner.close(); |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue