1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@oclif/command");
|
4 | const cli_ux_1 = require("cli-ux");
|
5 | const _ = require("lodash");
|
6 | class 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 | }
|
24 | Commands.description = 'list all the commands';
|
25 | Commands.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 | };
|
30 | exports.default = Commands;
|