1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | exports.parse = exports.flags = exports.args = void 0;
|
5 | const tslib_1 = require("tslib");
|
6 | const args = tslib_1.__importStar(require("./args"));
|
7 | exports.args = args;
|
8 | const deps_1 = tslib_1.__importDefault(require("./deps"));
|
9 | const flags = tslib_1.__importStar(require("./flags"));
|
10 | exports.flags = flags;
|
11 | const parse_1 = require("./parse");
|
12 | var help_1 = require("./help");
|
13 | Object.defineProperty(exports, "flagUsages", { enumerable: true, get: function () { return help_1.flagUsages; } });
|
14 |
|
15 | const m = deps_1.default()
|
16 |
|
17 | .add('validate', () => require('./validate').validate);
|
18 | function parse(argv, options) {
|
19 | const input = {
|
20 | argv,
|
21 | context: options.context,
|
22 | args: (options.args || []).map((a) => args.newArg(a)),
|
23 | '--': options['--'],
|
24 | flags: Object.assign({ color: flags.defaultFlags.color }, ((options.flags || {}))),
|
25 | strict: options.strict !== false,
|
26 | };
|
27 | const parser = new parse_1.Parser(input);
|
28 | const output = parser.parse();
|
29 | m.validate({ input, output });
|
30 | return output;
|
31 | }
|
32 | exports.parse = parse;
|