mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2024-12-21 20:08:21 -05:00
Fix crash when finding version when mod manager is not initialised
This commit is contained in:
parent
562b43e0b0
commit
066a63f913
@ -5,7 +5,7 @@ import Subcommand from "./subcommand.js";
|
||||
export default class InitCommand implements Subcommand {
|
||||
registerCommand(program: Command) {
|
||||
program.command("init")
|
||||
.description("Initialises mod manager")
|
||||
.description("Initialises mod manager. Execute in the root of the server directory you want to use Mod Manager in")
|
||||
.action(async () => {
|
||||
await Initialiser.initialise();
|
||||
});
|
||||
|
@ -18,6 +18,7 @@ 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";
|
||||
import chalk from "chalk";
|
||||
|
||||
export default class ModManager {
|
||||
public static logger: Logger | null = null;
|
||||
@ -46,10 +47,14 @@ export default class ModManager {
|
||||
this.logger = ModManager.createLogger();
|
||||
}
|
||||
|
||||
const version = Initialiser.isInitialised() ?
|
||||
await MinecraftUtils.getCurrentMinecraftVersion() :
|
||||
chalk.redBright("Not Initialised. See `mod-manager init -h` for more details!")
|
||||
|
||||
this.program
|
||||
.name('mod-manager')
|
||||
.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");
|
||||
.version(`Minecraft server version: ${version}`, "-v, --version", "Reports the version of the Minecraft server");
|
||||
|
||||
|
||||
for (const command of this.subcommands) {
|
||||
|
Loading…
Reference in New Issue
Block a user