1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = assertRequiredOptions;
|
7 |
|
8 | function _commander() {
|
9 | const data = require("commander");
|
10 |
|
11 | _commander = function () {
|
12 | return data;
|
13 | };
|
14 |
|
15 | return data;
|
16 | }
|
17 |
|
18 | function _lodash() {
|
19 | const data = require("lodash");
|
20 |
|
21 | _lodash = function () {
|
22 | return data;
|
23 | };
|
24 |
|
25 | return data;
|
26 | }
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | function assertRequiredOptions(options, passedOptions) {
|
40 | options.forEach(opt => {
|
41 | const option = new (_commander().Option)(opt.name);
|
42 |
|
43 | if (!option.required) {
|
44 | return;
|
45 | }
|
46 |
|
47 | const name = (0, _lodash().camelCase)(option.long);
|
48 |
|
49 | if (!passedOptions[name]) {
|
50 |
|
51 | throw new Error(`Option "${option.long}" is missing`);
|
52 | }
|
53 | });
|
54 | } |
\ | No newline at end of file |