mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +09:00
Ctl's commands.ts was starting to grow rather big, and future features and refactors are only going to make it bigger. Split it up into separate modules grouped by which category of commands it serves.
17 lines
616 B
TypeScript
17 lines
616 B
TypeScript
import asTableModule from "as-table";
|
|
|
|
import * as lib from "@clusterio/lib";
|
|
import type { Control } from "../ctl";
|
|
import { print } from "./command_ops";
|
|
|
|
const asTable = asTableModule.configure({ delimiter: " | " });
|
|
|
|
export const permissionCommands = new lib.CommandTree({ name: "permission", description: "Permission inspection" });
|
|
permissionCommands.add(new lib.Command({
|
|
definition: [["list", "l"], "List permissions in the cluster"],
|
|
handler: async function(args: object, control: Control) {
|
|
let permissions = await control.send(new lib.PermissionListRequest());
|
|
print(asTable(permissions));
|
|
},
|
|
}));
|