argue-cli 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js DELETED
@@ -1,403 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
6
-
7
- const argvStartIndex = 2;
8
- const shirtArgLength = 2;
9
-
10
- const argv = process.argv.slice(argvStartIndex, process.argv.length);
11
-
12
- function findName(name, names) {
13
-
14
- let findedName = false,
15
- array = false;
16
-
17
- names.some(fullNameOrigin => {
18
-
19
- let keys = null,
20
- fullName = fullNameOrigin,
21
- shirtName = null;
22
-
23
- if (typeof fullName == 'string') {
24
-
25
- if (fullName == name) {
26
- findedName = fullName;
27
- return true;
28
- }
29
-
30
- return false;
31
- }
32
-
33
- const proto = Object.getPrototypeOf(fullName); // eslint-disable-line
34
-
35
- if (proto == Object.prototype) {
36
-
37
- keys = fullName;
38
- fullName = Object.keys(keys)[0];
39
- shirtName = keys[fullName];
40
-
41
- if (fullName == name || shirtName == name) {
42
- findedName = fullName;
43
- return true;
44
- }
45
-
46
- return false;
47
- }
48
-
49
- if (proto == Array.prototype) {
50
- var _fullName = fullName;
51
-
52
- var _fullName2 = _slicedToArray(_fullName, 2);
53
-
54
- fullName = _fullName2[0];
55
- shirtName = _fullName2[1];
56
-
57
-
58
- if (fullName == name || shirtName == name) {
59
- array = true;
60
- findedName = fullName;
61
- return true;
62
- }
63
-
64
- return false;
65
- }
66
-
67
- return false;
68
- });
69
-
70
- return findedName ? { name: findedName, isArray: array } : false;
71
- }
72
-
73
- function setArguments(...newArguments) {
74
- argv.splice(0, argv.length);
75
- argv.push(...newArguments);
76
- }
77
-
78
- /**
79
- * Strict expectation one of given commands.
80
- *
81
- * command-line-app install
82
- *
83
- * expect(
84
- * {"install": "i"}, - fullname and shirtname
85
- * ["update", "u"], - also fullname and shirtname
86
- * "info" - only one variant of name
87
- * )
88
- *
89
- * @param {...Object} names array of expected tokens
90
- * @return {String} fullname
91
- */
92
- function expect(...names) {
93
-
94
- if (!argv.length) {
95
- throw new Error('Unexpected end of arguments.');
96
- }
97
-
98
- const sourceKey = argv.shift(),
99
- argument = findName(sourceKey, names);
100
-
101
- if (!argument) {
102
- throw new Error(`Unexpected argument "${sourceKey}".`);
103
- }
104
-
105
- return argument.name;
106
- }
107
-
108
- /**
109
- * Strict reading of argument.
110
- *
111
- * command-line-app some-value
112
- *
113
- * @return {String} argument
114
- */
115
- function read() {
116
-
117
- if (!argv.length) {
118
- throw new Error('Unexpected end of arguments.');
119
- }
120
-
121
- return argv.shift();
122
- }
123
-
124
- /**
125
- * Strict expectation of end.
126
- * @returns {void}
127
- */
128
- function end() {
129
-
130
- if (argv.length) {
131
- throw new Error(`Unexpected argument "${argv[0]}".`);
132
- }
133
- }
134
-
135
- /**
136
- * Strict reading of flags and options.
137
- *
138
- * command-line-app --output test -p es2015,react --verbose
139
- *
140
- * strictOptions([
141
- * ["another"] - for flags array is same as object notation
142
- * "verbose" - only one variant of name
143
- * ], [
144
- * {"output": "o"}, - fullname and shirtname
145
- * ["plugins", "p"] - fullname and shirtname for array
146
- * ])
147
- *
148
- * @param {...Object} flagsNames array of tokens
149
- * @param {...Object} optionsNames array of tokens
150
- * @return {Object} fullname-value pairs
151
- */
152
- function strictOptions(flagsNames, optionsNames) {
153
-
154
- if (!argv.length) {
155
- return {};
156
- }
157
-
158
- const options = {};
159
-
160
- let argument = argv[0];
161
-
162
- while (argv.length && (argument.indexOf('--') == 0 || argument.indexOf('-') == 0 && argument.length == shirtArgLength)) {
163
-
164
- const sourceKey = argv.shift().replace(/^(--|-)/, ''),
165
- flagKey = findName(sourceKey, flagsNames),
166
- optionKey = findName(sourceKey, optionsNames);
167
-
168
- if (!flagKey && !optionKey) {
169
- throw new Error(`Unexpected key "${sourceKey}".`);
170
- }
171
-
172
- if (!flagKey && optionKey && !argv.length) {
173
- throw new Error(`Unexpected end of arguments.`);
174
- }
175
-
176
- let value = argv[0];
177
-
178
- if (optionKey && value.indexOf('--') != 0 && value.indexOf('-') != 0) {
179
-
180
- argv.shift();
181
-
182
- if (optionKey.isArray) {
183
- value = value.split(',').map(element => element.replace(/^['"]|["']$/g, ''));
184
- } else {
185
- value = value.replace(/^['"]|["']$/g, '');
186
- }
187
-
188
- options[optionKey.name] = value;
189
- } else if (flagKey) {
190
-
191
- options[flagKey.name] = true;
192
- } else {
193
- throw new Error(`Unexpected key "${value}".`);
194
- }
195
-
196
- argument = argv[0];
197
- }
198
-
199
- return options;
200
- }
201
-
202
- /**
203
- * Strict reading of options with equal sign.
204
- * If option is provided without value it will interpreted as `true`.
205
- *
206
- * command-line-app --output=test -p=es2015,react --verbose
207
- *
208
- * strictOptionsEqual(
209
- * {"output": "o"}, - fullname and shirtname
210
- * ["plugins", "p"], - fullname and shirtname for array
211
- * "verbose" - only one variant of name
212
- * )
213
- *
214
- * @param {...Object} names array of tokens
215
- * @return {Object} fullname-value pairs
216
- */
217
- function strictOptionsEqual(...names) {
218
-
219
- if (!argv.length) {
220
- return {};
221
- }
222
-
223
- const options = {};
224
-
225
- let argument = argv[0];
226
-
227
- while (argv.length && (argument.indexOf('--') == 0 || argument.indexOf('-') == 0)) {
228
- var _argv$shift$replace$s = argv.shift().replace(/^(--|-)/, '').split('='),
229
- _argv$shift$replace$s2 = _slicedToArray(_argv$shift$replace$s, 2);
230
-
231
- let sourceKey = _argv$shift$replace$s2[0],
232
- value = _argv$shift$replace$s2[1];
233
-
234
-
235
- const key = findName(sourceKey, names);
236
-
237
- if (!key) {
238
- throw new Error(`Unexpected key "${sourceKey}".`);
239
- }
240
-
241
- if (typeof value == 'undefined') {
242
- value = true;
243
- } else if (key.isArray) {
244
- value = value.split(',').map(element => element.replace(/^['"]|["']$/g, ''));
245
- } else {
246
- value = value.replace(/^['"]|["']$/g, '');
247
- }
248
-
249
- options[key.name] = value;
250
-
251
- argument = argv[0];
252
- }
253
-
254
- return options;
255
- }
256
-
257
- /**
258
- * Unlimited reading of flags and options.
259
- *
260
- * command-line-app --output test install -p es2015,react babel --verbose
261
- *
262
- * options([
263
- * ["another"] - for flags array is same as object notation
264
- * "verbose" - only one variant of name
265
- * ], [
266
- * {"output": "o"}, - fullname and shirtname
267
- * ["plugins", "p"] - fullname and shirtname for array
268
- * ])
269
- *
270
- * @param {...Object} flagsNames array of tokens
271
- * @param {...Object} optionsNames array of tokens
272
- * @return {Object} fullname-value pairs
273
- */
274
- function options(flagsNames, optionsNames) {
275
-
276
- if (!argv.length) {
277
- return {};
278
- }
279
-
280
- const options = {},
281
- argvc = argv.slice(),
282
- argc = argvc.length,
283
- remove = [];
284
-
285
- for (let i = 0, argument = argvc[i]; i < argc; argument = argvc[++i]) {
286
-
287
- if (argument.indexOf('--') != 0 && argument.indexOf('-') != 0) {
288
- continue;
289
- }
290
-
291
- const sourceKey = argument.replace(/^(--|-)/, ''),
292
- flagKey = findName(sourceKey, flagsNames),
293
- optionKey = findName(sourceKey, optionsNames);
294
-
295
- if (!flagKey && !optionKey) {
296
- throw new Error(`Unexpected key "${sourceKey}".`);
297
- }
298
-
299
- if (!flagKey && optionKey && i == argc - 1) {
300
- throw new Error(`Unexpected end of arguments.`);
301
- }
302
-
303
- let value = argvc[i + 1];
304
-
305
- if (optionKey && value.indexOf('--') != 0 && value.indexOf('-') != 0) {
306
-
307
- remove.unshift(i++);
308
-
309
- if (optionKey.isArray) {
310
- value = value.split(',').map(element => element.replace(/^['"]|["']$/g, ''));
311
- } else {
312
- value = value.replace(/^['"]|["']$/g, '');
313
- }
314
-
315
- options[optionKey.name] = value;
316
- } else if (flagKey) {
317
-
318
- options[flagKey.name] = true;
319
- } else {
320
- throw new Error(`Unexpected key "${value}".`);
321
- }
322
-
323
- remove.unshift(i);
324
- }
325
-
326
- remove.forEach(index => argv.splice(index, 1));
327
-
328
- return options;
329
- }
330
-
331
- /**
332
- * Unlimited reading of with equal sign.
333
- * If option is provided without value it will interpreted as `true`.
334
- *
335
- * command-line-app --output=test install -p=es2015,react babel --verbose
336
- *
337
- * optionsEqual(
338
- * {"output": "o"}, - fullname and shirtname
339
- * ["plugins", "p"], - fullname and shirtname for array
340
- * "verbose" - only one variant of name
341
- * )
342
- *
343
- * @param {...Object} names array of tokens
344
- * @return {Object} fullname-value pairs
345
- */
346
- function optionsEqual(...names) {
347
-
348
- if (!argv.length) {
349
- return {};
350
- }
351
-
352
- const options = {},
353
- argvc = argv.slice(),
354
- argc = argvc.length,
355
- remove = [];
356
-
357
- for (let i = 0, argument = argvc[i]; i < argc; argument = argvc[++i]) {
358
-
359
- if (argument.indexOf('-') != 0) {
360
- continue;
361
- }
362
-
363
- var _argument$replace$spl = argument.replace(/^(--|-)/, '').split('='),
364
- _argument$replace$spl2 = _slicedToArray(_argument$replace$spl, 2);
365
-
366
- let sourceKey = _argument$replace$spl2[0],
367
- value = _argument$replace$spl2[1];
368
-
369
-
370
- const key = findName(sourceKey, names);
371
-
372
- remove.unshift(i);
373
-
374
- if (!key) {
375
- throw new Error(`Unexpected key "${sourceKey}".`);
376
- }
377
-
378
- if (typeof value == 'undefined') {
379
- value = true;
380
- } else if (key.isArray) {
381
- value = value.split(',').map(element => element.replace(/^['"]|["']$/g, ''));
382
- } else {
383
- value = value.replace(/^['"]|["']$/g, '');
384
- }
385
-
386
- options[key.name] = value;
387
- }
388
-
389
- remove.forEach(index => argv.splice(index, 1));
390
-
391
- return options;
392
- }
393
-
394
- exports.argv = argv;
395
- exports.setArguments = setArguments;
396
- exports.expect = expect;
397
- exports.read = read;
398
- exports.end = end;
399
- exports.strictOptions = strictOptions;
400
- exports.strictOptionsEqual = strictOptionsEqual;
401
- exports.options = options;
402
- exports.optionsEqual = optionsEqual;
403
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["\nconst argvStartIndex = 2,\n\tshirtArgLength = 2;\n\nexport const argv = process.argv.slice(argvStartIndex, process.argv.length);\n\nfunction findName(name, names) {\n\n\tlet findedName = false,\n\t\tarray = false;\n\n\tnames.some((fullNameOrigin) => {\n\n\t\tlet keys = null,\n\t\t\tfullName = fullNameOrigin,\n\t\t\tshirtName = null;\n\n\t\tif (typeof fullName == 'string') {\n\n\t\t\tif (fullName == name) {\n\t\t\t\tfindedName = fullName;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tconst proto = Object.getPrototypeOf(fullName); // eslint-disable-line\n\n\t\tif (proto == Object.prototype) {\n\n\t\t\tkeys = fullName;\n\t\t\tfullName = Object.keys(keys)[0];\n\t\t\tshirtName = keys[fullName];\n\n\t\t\tif (fullName == name || shirtName == name) {\n\t\t\t\tfindedName = fullName;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif (proto == Array.prototype) {\n\n\t\t\t[fullName, shirtName] = fullName;\n\n\t\t\tif (fullName == name || shirtName == name) {\n\t\t\t\tarray = true;\n\t\t\t\tfindedName = fullName;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\treturn findedName\n\t\t? { name: findedName, isArray: array }\n\t\t: false\n\t;\n}\n\nexport function setArguments(...newArguments) {\n\targv.splice(0, argv.length);\n\targv.push(...newArguments);\n}\n\n/**\n * Strict expectation one of given commands.\n *\n * command-line-app install\n *\n * expect(\n * {\"install\": \"i\"}, - fullname and shirtname\n * [\"update\", \"u\"], - also fullname and shirtname\n * \"info\" - only one variant of name\n * )\n *\n * @param {...Object} names array of expected tokens\n * @return {String} fullname\n */\nexport function expect(...names) {\n\n\tif (!argv.length) {\n\t\tthrow new Error('Unexpected end of arguments.');\n\t}\n\n\tconst sourceKey = argv.shift(),\n\t\targument = findName(sourceKey, names);\n\n\tif (!argument) {\n\t\tthrow new Error(`Unexpected argument \"${sourceKey}\".`);\n\t}\n\n\treturn argument.name;\n}\n\n/**\n * Strict reading of argument.\n *\n * command-line-app some-value\n *\n * @return {String} argument\n */\nexport function read() {\n\n\tif (!argv.length) {\n\t\tthrow new Error('Unexpected end of arguments.');\n\t}\n\n\treturn argv.shift();\n}\n\n/**\n * Strict expectation of end.\n * @returns {void}\n */\nexport function end() {\n\n\tif (argv.length) {\n\t\tthrow new Error(`Unexpected argument \"${argv[0]}\".`);\n\t}\n}\n\n/**\n * Strict reading of flags and options.\n *\n * command-line-app --output test -p es2015,react --verbose\n *\n * strictOptions([\n * [\"another\"] - for flags array is same as object notation\n * \"verbose\" - only one variant of name\n * ], [\n * {\"output\": \"o\"}, - fullname and shirtname\n * [\"plugins\", \"p\"] - fullname and shirtname for array\n * ])\n *\n * @param {...Object} flagsNames array of tokens\n * @param {...Object} optionsNames array of tokens\n * @return {Object} fullname-value pairs\n */\nexport function strictOptions(flagsNames, optionsNames) {\n\n\tif (!argv.length) {\n\t\treturn {};\n\t}\n\n\tconst options = {};\n\n\tlet argument = argv[0];\n\n\twhile (\n\t\targv.length\n\t\t&& (\n\t\t\targument.indexOf('--') == 0\n\t\t\t|| argument.indexOf('-') == 0 && argument.length == shirtArgLength\n\t\t)\n\t) {\n\n\t\tconst sourceKey = argv.shift().replace(/^(--|-)/, ''),\n\t\t\tflagKey = findName(sourceKey, flagsNames),\n\t\t\toptionKey = findName(sourceKey, optionsNames);\n\n\t\tif (!flagKey && !optionKey) {\n\t\t\tthrow new Error(`Unexpected key \"${sourceKey}\".`);\n\t\t}\n\n\t\tif (!flagKey && optionKey && !argv.length) {\n\t\t\tthrow new Error(`Unexpected end of arguments.`);\n\t\t}\n\n\t\tlet value = argv[0];\n\n\t\tif (optionKey && value.indexOf('--') != 0\n\t\t\t&& value.indexOf('-') != 0\n\t\t) {\n\n\t\t\targv.shift();\n\n\t\t\tif (optionKey.isArray) {\n\t\t\t\tvalue = value.split(',').map(element => element.replace(/^['\"]|[\"']$/g, ''));\n\t\t\t} else {\n\t\t\t\tvalue = value.replace(/^['\"]|[\"']$/g, '');\n\t\t\t}\n\n\t\t\toptions[optionKey.name] = value;\n\n\t\t} else\n\t\tif (flagKey) {\n\n\t\t\toptions[flagKey.name] = true;\n\n\t\t} else {\n\t\t\tthrow new Error(`Unexpected key \"${value}\".`);\n\t\t}\n\n\t\targument = argv[0];\n\t}\n\n\treturn options;\n}\n\n/**\n * Strict reading of options with equal sign.\n * If option is provided without value it will interpreted as `true`.\n *\n * command-line-app --output=test -p=es2015,react --verbose\n *\n * strictOptionsEqual(\n * {\"output\": \"o\"}, - fullname and shirtname\n * [\"plugins\", \"p\"], - fullname and shirtname for array\n * \"verbose\" - only one variant of name\n * )\n *\n * @param {...Object} names array of tokens\n * @return {Object} fullname-value pairs\n */\nexport function strictOptionsEqual(...names) {\n\n\tif (!argv.length) {\n\t\treturn {};\n\t}\n\n\tconst options = {};\n\n\tlet argument = argv[0];\n\n\twhile (\n\t\targv.length\n\t\t&& (\n\t\t\targument.indexOf('--') == 0\n\t\t\t|| argument.indexOf('-') == 0\n\t\t)\n\t) {\n\n\t\tlet [sourceKey, value] = argv.shift().replace(/^(--|-)/, '').split('=');\n\n\t\tconst key = findName(sourceKey, names);\n\n\t\tif (!key) {\n\t\t\tthrow new Error(`Unexpected key \"${sourceKey}\".`);\n\t\t}\n\n\t\tif (typeof value == 'undefined') {\n\t\t\tvalue = true;\n\t\t} else\n\t\tif (key.isArray) {\n\t\t\tvalue = value.split(',').map(element => element.replace(/^['\"]|[\"']$/g, ''));\n\t\t} else {\n\t\t\tvalue = value.replace(/^['\"]|[\"']$/g, '');\n\t\t}\n\n\t\toptions[key.name] = value;\n\n\t\targument = argv[0];\n\t}\n\n\treturn options;\n}\n\n/**\n * Unlimited reading of flags and options.\n *\n * command-line-app --output test install -p es2015,react babel --verbose\n *\n * options([\n * [\"another\"] - for flags array is same as object notation\n * \"verbose\" - only one variant of name\n * ], [\n * {\"output\": \"o\"}, - fullname and shirtname\n * [\"plugins\", \"p\"] - fullname and shirtname for array\n * ])\n *\n * @param {...Object} flagsNames array of tokens\n * @param {...Object} optionsNames array of tokens\n * @return {Object} fullname-value pairs\n */\nexport function options(flagsNames, optionsNames) {\n\n\tif (!argv.length) {\n\t\treturn {};\n\t}\n\n\tconst options = {},\n\t\targvc = argv.slice(),\n\t\targc = argvc.length,\n\t\tremove = [];\n\n\tfor (let i = 0, argument = argvc[i]; i < argc; argument = argvc[++i]) {\n\n\t\tif (argument.indexOf('--') != 0\n\t\t\t&& argument.indexOf('-') != 0\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst sourceKey = argument.replace(/^(--|-)/, ''),\n\t\t\tflagKey = findName(sourceKey, flagsNames),\n\t\t\toptionKey = findName(sourceKey, optionsNames);\n\n\t\tif (!flagKey && !optionKey) {\n\t\t\tthrow new Error(`Unexpected key \"${sourceKey}\".`);\n\t\t}\n\n\t\tif (!flagKey && optionKey && i == argc - 1) {\n\t\t\tthrow new Error(`Unexpected end of arguments.`);\n\t\t}\n\n\t\tlet value = argvc[i + 1];\n\n\t\tif (optionKey && value.indexOf('--') != 0\n\t\t\t&& value.indexOf('-') != 0\n\t\t) {\n\n\t\t\tremove.unshift(i++);\n\n\t\t\tif (optionKey.isArray) {\n\t\t\t\tvalue = value.split(',').map(element => element.replace(/^['\"]|[\"']$/g, ''));\n\t\t\t} else {\n\t\t\t\tvalue = value.replace(/^['\"]|[\"']$/g, '');\n\t\t\t}\n\n\t\t\toptions[optionKey.name] = value;\n\n\t\t} else\n\t\tif (flagKey) {\n\n\t\t\toptions[flagKey.name] = true;\n\n\t\t} else {\n\t\t\tthrow new Error(`Unexpected key \"${value}\".`);\n\t\t}\n\n\t\tremove.unshift(i);\n\t}\n\n\tremove.forEach(index => argv.splice(index, 1));\n\n\treturn options;\n}\n\n/**\n * Unlimited reading of with equal sign.\n * If option is provided without value it will interpreted as `true`.\n *\n * command-line-app --output=test install -p=es2015,react babel --verbose\n *\n * optionsEqual(\n * {\"output\": \"o\"}, - fullname and shirtname\n * [\"plugins\", \"p\"], - fullname and shirtname for array\n * \"verbose\" - only one variant of name\n * )\n *\n * @param {...Object} names array of tokens\n * @return {Object} fullname-value pairs\n */\nexport function optionsEqual(...names) {\n\n\tif (!argv.length) {\n\t\treturn {};\n\t}\n\n\tconst options = {},\n\t\targvc = argv.slice(),\n\t\targc = argvc.length,\n\t\tremove = [];\n\n\tfor (let i = 0, argument = argvc[i]; i < argc; argument = argvc[++i]) {\n\n\t\tif (argument.indexOf('-') != 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet [sourceKey, value] = argument.replace(/^(--|-)/, '').split('=');\n\n\t\tconst key = findName(sourceKey, names);\n\n\t\tremove.unshift(i);\n\n\t\tif (!key) {\n\t\t\tthrow new Error(`Unexpected key \"${sourceKey}\".`);\n\t\t}\n\n\t\tif (typeof value == 'undefined') {\n\t\t\tvalue = true;\n\t\t} else\n\t\tif (key.isArray) {\n\t\t\tvalue = value.split(',').map(element => element.replace(/^['\"]|[\"']$/g, ''));\n\t\t} else {\n\t\t\tvalue = value.replace(/^['\"]|[\"']$/g, '');\n\t\t}\n\n\t\toptions[key.name] = value;\n\t}\n\n\tremove.forEach(index => argv.splice(index, 1));\n\n\treturn options;\n}\n"],"names":["argvStartIndex","shirtArgLength","argv","process","slice","length","findName","name","names","findedName","array","some","fullNameOrigin","keys","fullName","shirtName","proto","Object","getPrototypeOf","prototype","Array","isArray","setArguments","newArguments","splice","push","expect","Error","sourceKey","shift","argument","read","end","strictOptions","flagsNames","optionsNames","options","indexOf","replace","flagKey","optionKey","value","split","map","element","strictOptionsEqual","key","argvc","argc","remove","i","unshift","forEach","index","optionsEqual"],"mappings":";;;;;;AACA,MAAMA,iBAAiB,CAAvB;MACCC,iBAAiB,CADlB;;AAGA,AAAO,MAAMC,OAAOC,QAAQD,IAAR,CAAaE,KAAb,CAAmBJ,cAAnB,EAAmCG,QAAQD,IAAR,CAAaG,MAAhD,CAAb;;AAEP,SAASC,QAAT,CAAkBC,IAAlB,EAAwBC,KAAxB,EAA+B;;KAE1BC,aAAa,KAAjB;KACCC,QAAa,KADd;;OAGMC,IAAN,CAAYC,cAAD,IAAoB;;MAE1BC,OAAO,IAAX;MACCC,WAAWF,cADZ;MAECG,YAAY,IAFb;;MAII,OAAOD,QAAP,IAAmB,QAAvB,EAAiC;;OAE5BA,YAAYP,IAAhB,EAAsB;iBACRO,QAAb;WACO,IAAP;;;UAGM,KAAP;;;QAGKE,QAAQC,OAAOC,cAAP,CAAsBJ,QAAtB,CAAd,CAhB8B;;MAkB1BE,SAASC,OAAOE,SAApB,EAA+B;;UAEvBL,QAAP;cACWG,OAAOJ,IAAP,CAAYA,IAAZ,EAAkB,CAAlB,CAAX;eACYA,KAAKC,QAAL,CAAZ;;OAEIA,YAAYP,IAAZ,IAAoBQ,aAAaR,IAArC,EAA2C;iBAC7BO,QAAb;WACO,IAAP;;;UAGM,KAAP;;;MAGGE,SAASI,MAAMD,SAAnB,EAA8B;mBAELL,QAFK;;;;WAAA;YAAA;;;OAIzBA,YAAYP,IAAZ,IAAoBQ,aAAaR,IAArC,EAA2C;YAClC,IAAR;iBACaO,QAAb;WACO,IAAP;;;UAGM,KAAP;;;SAGM,KAAP;EA7CD;;QAgDOL,aACJ,EAAEF,MAAME,UAAR,EAAoBY,SAASX,KAA7B,EADI,GAEJ,KAFH;;;AAMD,AAAO,SAASY,YAAT,CAAsB,GAAGC,YAAzB,EAAuC;MACxCC,MAAL,CAAY,CAAZ,EAAetB,KAAKG,MAAp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