mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2025-07-11 21:49:43 -04:00
Add list command
This commit is contained in:
26
src/commands/list_command.ts
Normal file
26
src/commands/list_command.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import Subcommand from "./subcommand.js";
|
||||
import {Command} from "commander";
|
||||
import ModManager from "../mod-manager.js";
|
||||
import asTable from "as-table";
|
||||
import Mods from "../mods/mods.js";
|
||||
import PrintUtils from "../util/print_utils.js";
|
||||
import chalk from "chalk";
|
||||
import Util from "../util/util.js";
|
||||
|
||||
export class ListCommand implements Subcommand {
|
||||
registerCommand(program: Command): void {
|
||||
program.command("list")
|
||||
.description("Lists installed mods")
|
||||
.action(() => {
|
||||
ModManager.execute(() => {
|
||||
let tableFunc = asTable.configure ({
|
||||
title: x => chalk.cyanBright(Util.stringPrettyify(x)),
|
||||
delimiter: chalk.blueBright(' | '),
|
||||
dash: chalk.blueBright('-')
|
||||
})
|
||||
PrintUtils.info(tableFunc(Mods.getTrackedMods()))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user