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