From 5868bdc066dd2e0c04a74b4a924503c307513148 Mon Sep 17 00:00:00 2001 From: Kallum Jones Date: Tue, 9 Aug 2022 23:17:08 +0100 Subject: [PATCH] Add --version flag --- src/mod-manager.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod-manager.ts b/src/mod-manager.ts index 80f3fd7..ac4edad 100644 --- a/src/mod-manager.ts +++ b/src/mod-manager.ts @@ -17,6 +17,7 @@ import MigrateCommand from "./commands/migrate_command.js"; import ModrinthSource from "./mods/sources/modrinth_source.js"; import Mods from "./mods/mods.js"; import {CurseforgeSource} from "./mods/sources/curseforge_source.js"; +import MinecraftUtils from "./util/minecraft_utils.js"; export default class ModManager { public static logger: Logger | null = null; @@ -40,14 +41,16 @@ export default class ModManager { new MigrateCommand() ]; - static init() { + static async init() { if (Initialiser.isInitialised()) { this.logger = ModManager.createLogger(); } this.program .name('mod-manager') - .description('A package (mod) manager for Fabric Minecraft Servers'); + .description('A package (mod) manager for Fabric Minecraft Servers') + .version(`Minecraft server version: ${await MinecraftUtils.getCurrentMinecraftVersion()}`, "-v, --version", "Reports the version of the Minecraft server"); + for (const command of this.subcommands) { command.registerCommand(this.program); @@ -58,6 +61,7 @@ export default class ModManager { this.program.showSuggestionAfterError(); this.program.showHelpAfterError(); + this.program.parse(); }