Skip to content

Commit 0fce08d

Browse files
authored
Add version flag for cli (#414)
* Add version flag for cli, rename mc-version flag * Change to -V, revert mc-version
1 parent f2355fa commit 0fce08d

File tree

1 file changed

+14
-1
lines changed
  • implementations/cli/src/main/java/de/bluecolored/bluemap/cli

1 file changed

+14
-1
lines changed

implementations/cli/src/main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import de.bluecolored.bluemap.common.web.*;
4242
import de.bluecolored.bluemap.common.web.http.HttpRequestHandler;
4343
import de.bluecolored.bluemap.common.web.http.HttpServer;
44+
import de.bluecolored.bluemap.core.BlueMap;
4445
import de.bluecolored.bluemap.core.MinecraftVersion;
4546
import de.bluecolored.bluemap.core.logger.Logger;
4647
import de.bluecolored.bluemap.core.logger.LoggerLogger;
@@ -272,6 +273,12 @@ public static void main(String[] args) {
272273
return;
273274
}
274275

276+
//version
277+
if (cmd.hasOption("V")) {
278+
BlueMapCLI.printVersion();
279+
return;
280+
}
281+
275282
//config folder
276283
cli.configFolder = Path.of("config");
277284
if (cmd.hasOption("c")) {
@@ -381,7 +388,7 @@ private static Options createOptions() {
381388
Option.builder("v")
382389
.longOpt("mc-version")
383390
.hasArg()
384-
.argName("version")
391+
.argName("mc-version")
385392
.desc("Sets the minecraft-version, used e.g. to load resource-packs correctly. Defaults to the latest compatible version.")
386393
.build()
387394
);
@@ -407,6 +414,8 @@ private static Options createOptions() {
407414

408415
options.addOption("u", "watch", false, "Watches for file-changes after rendering and updates the map");
409416

417+
options.addOption("V", "version", false, "Print the current BlueMap version");
418+
410419
return options;
411420
}
412421

@@ -445,4 +454,8 @@ private static void printHelp() {
445454

446455
formatter.printHelp(command + " [options]", "\nOptions:", createOptions(), "\n" + footer);
447456
}
457+
458+
private static void printVersion() {
459+
System.out.printf("%s\n%s\n", BlueMap.VERSION, BlueMap.GIT_HASH);
460+
}
448461
}

0 commit comments

Comments
 (0)