From ae300e45188464c3fb2a9caf34593d7fd83b395c Mon Sep 17 00:00:00 2001 From: Meeples10 Date: Thu, 5 Oct 2023 13:22:09 -0400 Subject: [PATCH] Fix -T flag parsing --- pom.xml | 2 +- .../java/io/github/meeples10/mcresourceanalyzer/Main.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 001891f..762c839 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.github.meeples10.mcresourceanalyzer mc-resource-analyzer - 1.2.1 + 1.2.2 jar MCResourceAnalyzer diff --git a/src/main/java/io/github/meeples10/mcresourceanalyzer/Main.java b/src/main/java/io/github/meeples10/mcresourceanalyzer/Main.java index b0d80d9..25f6315 100644 --- a/src/main/java/io/github/meeples10/mcresourceanalyzer/Main.java +++ b/src/main/java/io/github/meeples10/mcresourceanalyzer/Main.java @@ -108,7 +108,7 @@ public String[] getVersion() throws Exception { .description("Adds a prefix to the program's output files.").build()); spec.addOption(OptionSpec.builder("-t", "--table") .description("Generates a simple HTML table with the collected data.").build()); - spec.addOption(OptionSpec.builder("-T", "--table-template").paramLabel("PATH").type(int.class).description( + spec.addOption(OptionSpec.builder("-T", "--table-template").paramLabel("PATH").type(String.class).description( "All instances of {{{TABLE}}} in the given file will be replaced by the table generated by the -t option.") .build()); spec.addOption(OptionSpec.builder("-s", "--statistics") @@ -171,7 +171,11 @@ private static int parseArgs(ParseResult pr) { if(pr.hasMatchedOption('T')) { File template = new File((String) pr.matchedOption('T').getValue()); if(!template.exists() || template.isDirectory()) { - System.err.println("Invalid table template: " + template.getPath()); + System.err.println("Table template not found: " + template.getPath()); + System.exit(1); + } + if(template.isDirectory()) { + System.err.println("Table template must be a file: " + template.getPath()); System.exit(1); } tableTemplatePath = template.getPath();