From 5d5c295ac40cf1d4b3e817dbf63dc8434beba892 Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Thu, 17 Oct 2024 18:56:26 +0200 Subject: [PATCH] feat: add argument for file --- app/src/main/java/Main.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/Main.java b/app/src/main/java/Main.java index f6364c4..436e63e 100644 --- a/app/src/main/java/Main.java +++ b/app/src/main/java/Main.java @@ -6,16 +6,15 @@ public class Main { // Get commandline arguments // Checks that only the file has been declared - // TODO Add arguments to read files from -// if (args.length != 1) { -// System.out.println("Invalid arguments, you need to define the text file to read from!"); -// return; -// } -// -// System.out.println(Arrays.toString(args)); + if (args.length != 1) { + System.out.println("Invalid arguments, you need to define the text file to read from!"); + return; + } + + Path filePath = Path.of(args[0]); // Get the data from the file - List data = ReadFile.open(Path.of("example.txt")); + List data = ReadFile.open(filePath); // Gets a map with the total occurrences for each domain Map domains = getDomainTotal(data);