UNPKG

ern-api-gen

Version:

Electrode Native API generator

24 lines 935 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const padEnd_1 = __importDefault(require("lodash/padEnd")); const Command_1 = require("./Command"); const SORT_CMDS = (a, b) => a.Usage.name.localeCompare(b.Usage.name); class Help { constructor(values, opts) { this.values = values; this.opts = opts; } run() { const { name, description, commands = [] } = this.opts; console.log(`${name}\n${description}`); for (const cmd of commands.sort(SORT_CMDS)) { console.log(`\t${padEnd_1.default(cmd.Usage.name, 20)} - ${cmd.Usage.description}`); } } } Help.Usage = new Command_1.Command({ name: 'help', description: 'This helpful message.' }, []); exports.Help = Help; //# sourceMappingURL=Help.js.map