Added functionality to mark mods as essential

This commit is contained in:
Kallum Jones
2022-08-04 16:04:21 +01:00
parent ab83374735
commit e913bafb1e
11 changed files with 106 additions and 29 deletions

View File

@ -0,0 +1,20 @@
import Subcommand from "./subcommand.js";
import {Command} from "commander";
import ModManager from "../mod-manager.js";
import Mods from "../mods/mods.js";
export default class EssentialCommand implements Subcommand {
registerCommand(program: Command): void {
program.command("essential")
.description("Marks mods as essential")
.argument("<mods...>", "The mods to mark as essential (as names or ids)")
.action((mods) => {
ModManager.execute(() => {
for (let mod of mods) {
Mods.markEssential(mod)
}
})
})
}
}

View File

@ -8,10 +8,11 @@ export default class InstallCommand implements Subcommand {
program.command("install")
.description("Installs the provided mods")
.argument("<mods...>", "The mods to install")
.action((mods) => {
.option("-e, --essential", "Marks these mods as essential", false)
.action(function() {
ModManager.execute(async () => {
for (const mod of mods) {
await Mods.install(mod);
for (const mod of this.args) {
await Mods.install(mod, this.opts().essential);
}
})
});

View File

@ -7,7 +7,7 @@ export default class UninstallCommand implements Subcommand {
registerCommand(program: Command): void {
program.command("uninstall")
.description("Uninstalls the provided mods")
.argument("<mods...>")
.argument("<mods...>", "The mods to uninstall (as names or ids)")
.action((mods) => {
ModManager.execute(() => {
for (let mod of mods) {