UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

26 lines (25 loc) 777 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCommandsByGroup = exports.getAllCommands = exports.getCommand = exports.registerCommand = void 0; const commands = new Map(); function registerCommand(def) { if (commands.has(def.name)) { throw new Error(`Command "${def.name}" is already registered`); } commands.set(def.name, def); } exports.registerCommand = registerCommand; function getCommand(name) { return commands.get(name); } exports.getCommand = getCommand; function getAllCommands() { return Array.from(commands.values()); } exports.getAllCommands = getAllCommands; function getCommandsByGroup(group) { return getAllCommands().filter(c => c.group === group); } exports.getCommandsByGroup = getCommandsByGroup;