mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2025-07-11 21:49:43 -04:00
Added functionality to mark mods as essential
This commit is contained in:
20
src/commands/essential_command.ts
Normal file
20
src/commands/essential_command.ts
Normal 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)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user