1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
|
4 | const init_1 = require("./init");
|
5 | const list_1 = require("./list");
|
6 | const cli_options_1 = require("./common/cli-options");
|
7 | const program = require('commander');
|
8 | exports.ownVersion = require('../package').version;
|
9 | program.version(exports.ownVersion, '-v, --version')
|
10 | .usage('[command] [options]');
|
11 | const clients = init_1.collectClients();
|
12 | program
|
13 | .command('list')
|
14 | .description('List all available clients and their clients')
|
15 | .option('-s, --save [saveTo]', 'Save information about clients ')
|
16 | .action((cmd) => list_1.exportList(clients, cmd));
|
17 | clients.forEach(client => {
|
18 | client.generators.forEach(function (generator) {
|
19 | const generationCommand = program
|
20 | .command(`${client.name}:${generator.name}`)
|
21 | .description(`Generates ${client.name} ${generator.name}`);
|
22 | cli_options_1.extractAvailableOptions(generator.options).forEach(({ pattern, description }) => {
|
23 | generationCommand.option(pattern, description);
|
24 | });
|
25 | generationCommand.action(function (cmd) {
|
26 | return init_1.generate(client.name, generator.name, cli_options_1.pickOptions(cmd, generator.options));
|
27 | });
|
28 | });
|
29 | });
|
30 | program.parse(process.argv);
|
31 | if (!process.argv.slice(2).length) {
|
32 | program.outputHelp();
|
33 | }
|
34 |
|
\ | No newline at end of file |