diff --git a/src/mod-manager.ts b/src/mod-manager.ts index 599b9ec..ca83c72 100644 --- a/src/mod-manager.ts +++ b/src/mod-manager.ts @@ -64,7 +64,7 @@ export default class ModManager { Mods.registerSource(new ModrinthSource()) Mods.registerSource(new CurseforgeSource(), "CURSEFORGE_API_KEY") - Mods.registerSource(new ForgejoSource(), "FORGEJO_API_KEY") + Mods.registerSource(new ForgejoSource(), "FORGEJO_API_KEY", true) this.program.showSuggestionAfterError(); this.program.showHelpAfterError(); diff --git a/src/mods/mods.ts b/src/mods/mods.ts index 633edb5..4ad6825 100644 --- a/src/mods/mods.ts +++ b/src/mods/mods.ts @@ -13,12 +13,12 @@ import chalk from "chalk"; export default class Mods { private static readonly MOD_SOURCES: Array = []; - public static registerSource(source: ModSource, envVar?: string) { - if (envVar != undefined) { - if (!process.env.hasOwnProperty(envVar)) { + public static registerSource(source: ModSource, envVar?: string, suppressWarning?: boolean) { + if (envVar && !process.env.hasOwnProperty(envVar)) { + if (!suppressWarning) PrintUtils.warn(`${source.getSourceName()} could not be registered as a mod source, as the required environment variable ${envVar} was not detected. Functionality related to ${source.getSourceName()} will be skipped.`) - return; - } + + return; } this.MOD_SOURCES.push(source); }