UNPKG

1 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const command_1 = require("@oclif/command");
4const cli_ux_1 = require("cli-ux");
5const _ = require("lodash");
6class Commands extends command_1.Command {
7 async run() {
8 const { flags } = this.parse(Commands);
9 let commands = this.config.commands;
10 if (!flags.hidden) {
11 commands = commands.filter(c => !c.hidden);
12 }
13 commands = _.sortBy(commands, 'id');
14 if (flags.json) {
15 cli_ux_1.default.styledJSON(commands);
16 }
17 else {
18 for (let c of commands) {
19 this.log(c.id);
20 }
21 }
22 }
23}
24Commands.description = 'list all the commands';
25Commands.flags = {
26 help: command_1.flags.help({ char: 'h' }),
27 json: command_1.flags.boolean({ char: 'j', description: 'output in json format' }),
28 hidden: command_1.flags.boolean({ description: 'also show hidden commands' }),
29};
30exports.default = Commands;