1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.help = exports.version = exports.string = exports.enum = exports.option = exports.build = void 0;
|
4 | const Parser = require("@oclif/parser");
|
5 | function build(defaults) {
|
6 | return Parser.flags.build(defaults);
|
7 | }
|
8 | exports.build = build;
|
9 | function option(options) {
|
10 | return build(options)();
|
11 | }
|
12 | exports.option = option;
|
13 | const _enum = (opts) => {
|
14 | return build(Object.assign({ parse(input) {
|
15 | if (!opts.options.includes(input))
|
16 | throw new Error(`Expected --${this.name}=${input} to be one of: ${opts.options.join(', ')}`);
|
17 | return input;
|
18 | }, helpValue: `(${opts.options.join('|')})` }, opts))();
|
19 | };
|
20 | exports.enum = _enum;
|
21 | const stringFlag = build({});
|
22 | exports.string = stringFlag;
|
23 | var flags_1 = require("@oclif/parser/lib/flags");
|
24 | Object.defineProperty(exports, "boolean", { enumerable: true, get: function () { return flags_1.boolean; } });
|
25 | Object.defineProperty(exports, "integer", { enumerable: true, get: function () { return flags_1.integer; } });
|
26 | exports.version = (opts = {}) => {
|
27 | return Parser.flags.boolean(Object.assign(Object.assign({
|
28 |
|
29 | description: 'show CLI version' }, opts), { parse: (_, cmd) => {
|
30 | cmd.log(cmd.config.userAgent);
|
31 | cmd.exit(0);
|
32 | } }));
|
33 | };
|
34 | exports.help = (opts = {}) => {
|
35 | return Parser.flags.boolean(Object.assign(Object.assign({
|
36 |
|
37 | description: 'show CLI help' }, opts), { parse: (_, cmd) => {
|
38 | cmd._help();
|
39 | } }));
|
40 | };
|