yargs 16.0.3 → 16.2.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/CHANGELOG.md +34 -293
- package/README.md +27 -8
- package/browser.mjs +4 -4
- package/build/index.cjs +432 -276
- package/build/lib/argsert.js +9 -5
- package/build/lib/command.js +98 -74
- package/build/lib/completion.js +27 -14
- package/build/lib/middleware.js +5 -3
- package/build/lib/parse-command.js +3 -3
- package/build/lib/usage.js +81 -47
- package/build/lib/utils/apply-extends.js +8 -7
- package/build/lib/utils/is-promise.js +2 -2
- package/build/lib/utils/obj-filter.js +1 -1
- package/build/lib/utils/set-blocking.js +4 -2
- package/build/lib/utils/which-module.js +1 -1
- package/build/lib/validation.js +39 -32
- package/build/lib/yargs-factory.js +153 -87
- package/helpers/helpers.mjs +10 -0
- package/helpers/index.js +14 -0
- package/helpers/package.json +3 -0
- package/index.cjs +17 -17
- package/index.mjs +5 -5
- package/lib/platform-shims/browser.mjs +38 -37
- package/package.json +35 -26
- package/yargs +3 -2
- package/helpers.mjs +0 -14
package/build/index.cjs
CHANGED
|
@@ -24,24 +24,25 @@ function applyExtends(config, cwd, mergeExtends, _shim) {
|
|
|
24
24
|
try {
|
|
25
25
|
pathToDefault = require.resolve(config.extends);
|
|
26
26
|
}
|
|
27
|
-
catch (
|
|
27
|
+
catch (_err) {
|
|
28
|
+
return config;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
|
|
32
33
|
}
|
|
33
|
-
if (!pathToDefault && !isPath)
|
|
34
|
-
return config;
|
|
35
|
-
if (!pathToDefault)
|
|
36
|
-
throw new YError(`Unable to find extended config '${config.extends}' in '${cwd}'.`);
|
|
37
34
|
checkForCircularExtends(pathToDefault);
|
|
38
35
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
39
|
-
defaultConfig = isPath
|
|
36
|
+
defaultConfig = isPath
|
|
37
|
+
? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
|
|
38
|
+
: require(config.extends);
|
|
40
39
|
delete config.extends;
|
|
41
40
|
defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
|
|
42
41
|
}
|
|
43
42
|
previouslyVisitedConfigs = [];
|
|
44
|
-
return mergeExtends
|
|
43
|
+
return mergeExtends
|
|
44
|
+
? mergeDeep(defaultConfig, config)
|
|
45
|
+
: Object.assign({}, defaultConfig, config);
|
|
45
46
|
}
|
|
46
47
|
function checkForCircularExtends(cfgPath) {
|
|
47
48
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -78,7 +79,7 @@ function parseCommand(cmd) {
|
|
|
78
79
|
const parsedCommand = {
|
|
79
80
|
cmd: firstCommand.replace(bregex, ''),
|
|
80
81
|
demanded: [],
|
|
81
|
-
optional: []
|
|
82
|
+
optional: [],
|
|
82
83
|
};
|
|
83
84
|
splitCommand.forEach((cmd, i) => {
|
|
84
85
|
let variadic = false;
|
|
@@ -88,13 +89,13 @@ function parseCommand(cmd) {
|
|
|
88
89
|
if (/^\[/.test(cmd)) {
|
|
89
90
|
parsedCommand.optional.push({
|
|
90
91
|
cmd: cmd.replace(bregex, '').split('|'),
|
|
91
|
-
variadic
|
|
92
|
+
variadic,
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
else {
|
|
95
96
|
parsedCommand.demanded.push({
|
|
96
97
|
cmd: cmd.replace(bregex, '').split('|'),
|
|
97
|
-
variadic
|
|
98
|
+
variadic,
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
});
|
|
@@ -106,15 +107,19 @@ function argsert(arg1, arg2, arg3) {
|
|
|
106
107
|
function parseArgs() {
|
|
107
108
|
return typeof arg1 === 'object'
|
|
108
109
|
? [{ demanded: [], optional: [] }, arg1, arg2]
|
|
109
|
-
: [
|
|
110
|
+
: [
|
|
111
|
+
parseCommand(`cmd ${arg1}`),
|
|
112
|
+
arg2,
|
|
113
|
+
arg3,
|
|
114
|
+
];
|
|
110
115
|
}
|
|
111
116
|
try {
|
|
112
117
|
let position = 0;
|
|
113
|
-
|
|
118
|
+
const [parsed, callerArguments, _length] = parseArgs();
|
|
114
119
|
const args = [].slice.call(callerArguments);
|
|
115
120
|
while (args.length && args[args.length - 1] === undefined)
|
|
116
121
|
args.pop();
|
|
117
|
-
length =
|
|
122
|
+
const length = _length || args.length;
|
|
118
123
|
if (length < parsed.demanded.length) {
|
|
119
124
|
throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
|
|
120
125
|
}
|
|
@@ -122,7 +127,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
122
127
|
if (length > totalCommands) {
|
|
123
128
|
throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
|
|
124
129
|
}
|
|
125
|
-
parsed.demanded.forEach(
|
|
130
|
+
parsed.demanded.forEach(demanded => {
|
|
126
131
|
const arg = args.shift();
|
|
127
132
|
const observedType = guessType(arg);
|
|
128
133
|
const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
|
|
@@ -130,7 +135,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
130
135
|
argumentTypeError(observedType, demanded.cmd, position);
|
|
131
136
|
position += 1;
|
|
132
137
|
});
|
|
133
|
-
parsed.optional.forEach(
|
|
138
|
+
parsed.optional.forEach(optional => {
|
|
134
139
|
if (args.length === 0)
|
|
135
140
|
return;
|
|
136
141
|
const arg = args.shift();
|
|
@@ -159,9 +164,9 @@ function argumentTypeError(observedType, allowedTypes, position) {
|
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
function isPromise(maybePromise) {
|
|
162
|
-
return !!maybePromise &&
|
|
167
|
+
return (!!maybePromise &&
|
|
163
168
|
!!maybePromise.then &&
|
|
164
|
-
|
|
169
|
+
typeof maybePromise.then === 'function');
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
function assertNotStrictEqual(actual, expected, shim, message) {
|
|
@@ -176,7 +181,7 @@ function objectKeys(object) {
|
|
|
176
181
|
|
|
177
182
|
function objFilter(original = {}, filter = () => true) {
|
|
178
183
|
const obj = {};
|
|
179
|
-
objectKeys(original).forEach(
|
|
184
|
+
objectKeys(original).forEach(key => {
|
|
180
185
|
if (filter(key, original[key])) {
|
|
181
186
|
obj[key] = original[key];
|
|
182
187
|
}
|
|
@@ -213,14 +218,16 @@ function commandMiddlewareFactory(commandMiddleware) {
|
|
|
213
218
|
}
|
|
214
219
|
function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
|
|
215
220
|
const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true');
|
|
216
|
-
return middlewares
|
|
217
|
-
.reduce((acc, middleware) => {
|
|
221
|
+
return middlewares.reduce((acc, middleware) => {
|
|
218
222
|
if (middleware.applyBeforeValidation !== beforeValidation) {
|
|
219
223
|
return acc;
|
|
220
224
|
}
|
|
221
225
|
if (isPromise(acc)) {
|
|
222
226
|
return acc
|
|
223
|
-
.then(initialObj => Promise.all([
|
|
227
|
+
.then(initialObj => Promise.all([
|
|
228
|
+
initialObj,
|
|
229
|
+
middleware(initialObj, yargs),
|
|
230
|
+
]))
|
|
224
231
|
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
|
|
225
232
|
}
|
|
226
233
|
else {
|
|
@@ -261,7 +268,7 @@ var processArgv = /*#__PURE__*/Object.freeze({
|
|
|
261
268
|
function whichModule(exported) {
|
|
262
269
|
if (typeof require === 'undefined')
|
|
263
270
|
return null;
|
|
264
|
-
for (
|
|
271
|
+
for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
|
|
265
272
|
mod = require.cache[files[i]];
|
|
266
273
|
if (mod.exports === exported)
|
|
267
274
|
return mod;
|
|
@@ -280,55 +287,65 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
280
287
|
const middlewares = commandMiddlewareFactory(commandMiddleware);
|
|
281
288
|
handler = handler || (() => { });
|
|
282
289
|
if (Array.isArray(cmd)) {
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
if (isCommandAndAliases(cmd)) {
|
|
291
|
+
[cmd, ...aliases] = cmd;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
for (const command of cmd) {
|
|
295
|
+
self.addHandler(command);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
285
298
|
}
|
|
286
299
|
else if (isCommandHandlerDefinition(cmd)) {
|
|
287
|
-
let command =
|
|
300
|
+
let command = Array.isArray(cmd.command) || typeof cmd.command === 'string'
|
|
301
|
+
? cmd.command
|
|
302
|
+
: moduleName(cmd);
|
|
288
303
|
if (cmd.aliases)
|
|
289
304
|
command = [].concat(command).concat(cmd.aliases);
|
|
290
305
|
self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
|
|
291
306
|
return;
|
|
292
307
|
}
|
|
293
|
-
if (isCommandBuilderDefinition(builder)) {
|
|
308
|
+
else if (isCommandBuilderDefinition(builder)) {
|
|
294
309
|
self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
|
|
295
310
|
return;
|
|
296
311
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
parsedAliases.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
if (typeof cmd === 'string') {
|
|
313
|
+
const parsedCommand = parseCommand(cmd);
|
|
314
|
+
aliases = aliases.map(alias => parseCommand(alias).cmd);
|
|
315
|
+
let isDefault = false;
|
|
316
|
+
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => {
|
|
317
|
+
if (DEFAULT_MARKER.test(c)) {
|
|
318
|
+
isDefault = true;
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
return true;
|
|
322
|
+
});
|
|
323
|
+
if (parsedAliases.length === 0 && isDefault)
|
|
324
|
+
parsedAliases.push('$0');
|
|
325
|
+
if (isDefault) {
|
|
326
|
+
parsedCommand.cmd = parsedAliases[0];
|
|
327
|
+
aliases = parsedAliases.slice(1);
|
|
328
|
+
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
|
|
329
|
+
}
|
|
330
|
+
aliases.forEach(alias => {
|
|
331
|
+
aliasMap[alias] = parsedCommand.cmd;
|
|
332
|
+
});
|
|
333
|
+
if (description !== false) {
|
|
334
|
+
usage.command(cmd, description, isDefault, aliases, deprecated);
|
|
335
|
+
}
|
|
336
|
+
handlers[parsedCommand.cmd] = {
|
|
337
|
+
original: cmd,
|
|
338
|
+
description,
|
|
339
|
+
handler,
|
|
340
|
+
builder: builder || {},
|
|
341
|
+
middlewares,
|
|
342
|
+
deprecated,
|
|
343
|
+
demanded: parsedCommand.demanded,
|
|
344
|
+
optional: parsedCommand.optional,
|
|
345
|
+
};
|
|
346
|
+
if (isDefault)
|
|
347
|
+
defaultCommand = handlers[parsedCommand.cmd];
|
|
313
348
|
}
|
|
314
|
-
aliases.forEach((alias) => {
|
|
315
|
-
aliasMap[alias] = parsedCommand.cmd;
|
|
316
|
-
});
|
|
317
|
-
if (description !== false) {
|
|
318
|
-
usage.command(cmd, description, isDefault, aliases, deprecated);
|
|
319
|
-
}
|
|
320
|
-
handlers[parsedCommand.cmd] = {
|
|
321
|
-
original: cmd,
|
|
322
|
-
description,
|
|
323
|
-
handler,
|
|
324
|
-
builder: builder || {},
|
|
325
|
-
middlewares,
|
|
326
|
-
deprecated,
|
|
327
|
-
demanded: parsedCommand.demanded,
|
|
328
|
-
optional: parsedCommand.optional
|
|
329
|
-
};
|
|
330
|
-
if (isDefault)
|
|
331
|
-
defaultCommand = handlers[parsedCommand.cmd];
|
|
332
349
|
};
|
|
333
350
|
self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) {
|
|
334
351
|
opts = opts || {};
|
|
@@ -358,7 +375,7 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
358
375
|
function commandFromFilename(filename) {
|
|
359
376
|
return shim.path.basename(filename, shim.path.extname(filename));
|
|
360
377
|
}
|
|
361
|
-
function extractDesc({ describe, description, desc }) {
|
|
378
|
+
function extractDesc({ describe, description, desc, }) {
|
|
362
379
|
for (const test of [describe, description, desc]) {
|
|
363
380
|
if (typeof test === 'string' || test === false)
|
|
364
381
|
return test;
|
|
@@ -386,7 +403,9 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
386
403
|
const builderOutput = builder(yargs.reset(parsed.aliases));
|
|
387
404
|
const innerYargs = isYargsInstance(builderOutput) ? builderOutput : yargs;
|
|
388
405
|
if (shouldUpdateUsage(innerYargs)) {
|
|
389
|
-
innerYargs
|
|
406
|
+
innerYargs
|
|
407
|
+
.getUsageInstance()
|
|
408
|
+
.usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
|
|
390
409
|
}
|
|
391
410
|
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
|
|
392
411
|
aliases = innerYargs.parsed.aliases;
|
|
@@ -394,9 +413,11 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
394
413
|
else if (isCommandBuilderOptionDefinitions(builder)) {
|
|
395
414
|
const innerYargs = yargs.reset(parsed.aliases);
|
|
396
415
|
if (shouldUpdateUsage(innerYargs)) {
|
|
397
|
-
innerYargs
|
|
416
|
+
innerYargs
|
|
417
|
+
.getUsageInstance()
|
|
418
|
+
.usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
|
|
398
419
|
}
|
|
399
|
-
Object.keys(commandHandler.builder).forEach(
|
|
420
|
+
Object.keys(commandHandler.builder).forEach(key => {
|
|
400
421
|
innerYargs.option(key, builder[key]);
|
|
401
422
|
});
|
|
402
423
|
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
|
|
@@ -405,7 +426,9 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
405
426
|
if (!yargs._hasOutput()) {
|
|
406
427
|
positionalMap = populatePositionals(commandHandler, innerArgv, currentContext);
|
|
407
428
|
}
|
|
408
|
-
const middlewares = globalMiddleware
|
|
429
|
+
const middlewares = globalMiddleware
|
|
430
|
+
.slice(0)
|
|
431
|
+
.concat(commandHandler.middlewares);
|
|
409
432
|
applyMiddleware(innerArgv, yargs, middlewares, true);
|
|
410
433
|
if (!yargs._hasOutput()) {
|
|
411
434
|
yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command);
|
|
@@ -413,8 +436,7 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
413
436
|
if (commandHandler.handler && !yargs._hasOutput()) {
|
|
414
437
|
yargs._setHasOutput();
|
|
415
438
|
const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
|
|
416
|
-
|
|
417
|
-
yargs._copyDoubleDash(innerArgv);
|
|
439
|
+
yargs._postProcess(innerArgv, populateDoubleDash);
|
|
418
440
|
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
|
|
419
441
|
let handlerResult;
|
|
420
442
|
if (isPromise(innerArgv)) {
|
|
@@ -459,12 +481,16 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
459
481
|
return innerArgv;
|
|
460
482
|
};
|
|
461
483
|
function shouldUpdateUsage(yargs) {
|
|
462
|
-
return !yargs.getUsageInstance().getUsageDisabled() &&
|
|
463
|
-
yargs.getUsageInstance().getUsage().length === 0;
|
|
484
|
+
return (!yargs.getUsageInstance().getUsageDisabled() &&
|
|
485
|
+
yargs.getUsageInstance().getUsage().length === 0);
|
|
464
486
|
}
|
|
465
487
|
function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
|
|
466
|
-
const c = DEFAULT_MARKER.test(commandHandler.original)
|
|
467
|
-
|
|
488
|
+
const c = DEFAULT_MARKER.test(commandHandler.original)
|
|
489
|
+
? commandHandler.original.replace(DEFAULT_MARKER, '').trim()
|
|
490
|
+
: commandHandler.original;
|
|
491
|
+
const pc = parentCommands.filter(c => {
|
|
492
|
+
return !DEFAULT_MARKER.test(c);
|
|
493
|
+
});
|
|
468
494
|
pc.push(c);
|
|
469
495
|
return `$0 ${pc.join(' ')}`;
|
|
470
496
|
}
|
|
@@ -472,15 +498,16 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
472
498
|
assertNotStrictEqual(defaultCommand, undefined, shim);
|
|
473
499
|
if (shouldUpdateUsage(yargs)) {
|
|
474
500
|
const commandString = DEFAULT_MARKER.test(defaultCommand.original)
|
|
475
|
-
? defaultCommand.original
|
|
501
|
+
? defaultCommand.original
|
|
502
|
+
: defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
|
|
476
503
|
yargs.getUsageInstance().usage(commandString, defaultCommand.description);
|
|
477
504
|
}
|
|
478
505
|
const builder = defaultCommand.builder;
|
|
479
506
|
if (isCommandBuilderCallback(builder)) {
|
|
480
507
|
builder(yargs);
|
|
481
508
|
}
|
|
482
|
-
else {
|
|
483
|
-
Object.keys(builder).forEach(
|
|
509
|
+
else if (!isCommandBuilderDefinition(builder)) {
|
|
510
|
+
Object.keys(builder).forEach(key => {
|
|
484
511
|
yargs.option(key, builder[key]);
|
|
485
512
|
});
|
|
486
513
|
}
|
|
@@ -522,8 +549,8 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
522
549
|
options.array = options.array.concat(parseOptions.array);
|
|
523
550
|
options.config = {};
|
|
524
551
|
const unparsed = [];
|
|
525
|
-
Object.keys(positionalMap).forEach(
|
|
526
|
-
positionalMap[key].map(
|
|
552
|
+
Object.keys(positionalMap).forEach(key => {
|
|
553
|
+
positionalMap[key].map(value => {
|
|
527
554
|
if (options.configuration['unknown-options-as-args'])
|
|
528
555
|
options.key[key] = true;
|
|
529
556
|
unparsed.push(`--${key}`);
|
|
@@ -533,20 +560,20 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
533
560
|
if (!unparsed.length)
|
|
534
561
|
return;
|
|
535
562
|
const config = Object.assign({}, options.configuration, {
|
|
536
|
-
'populate--': true
|
|
563
|
+
'populate--': true,
|
|
537
564
|
});
|
|
538
565
|
const parsed = shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
539
|
-
configuration: config
|
|
566
|
+
configuration: config,
|
|
540
567
|
}));
|
|
541
568
|
if (parsed.error) {
|
|
542
569
|
yargs.getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
543
570
|
}
|
|
544
571
|
else {
|
|
545
572
|
const positionalKeys = Object.keys(positionalMap);
|
|
546
|
-
Object.keys(positionalMap).forEach(
|
|
573
|
+
Object.keys(positionalMap).forEach(key => {
|
|
547
574
|
positionalKeys.push(...parsed.aliases[key]);
|
|
548
575
|
});
|
|
549
|
-
Object.keys(parsed.argv).forEach(
|
|
576
|
+
Object.keys(parsed.argv).forEach(key => {
|
|
550
577
|
if (positionalKeys.indexOf(key) !== -1) {
|
|
551
578
|
if (!positionalMap[key])
|
|
552
579
|
positionalMap[key] = parsed.argv[key];
|
|
@@ -560,10 +587,10 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
560
587
|
array: [],
|
|
561
588
|
default: {},
|
|
562
589
|
alias: {},
|
|
563
|
-
demand: {}
|
|
590
|
+
demand: {},
|
|
564
591
|
};
|
|
565
592
|
const parsed = parseCommand(cmdString);
|
|
566
|
-
parsed.demanded.forEach(
|
|
593
|
+
parsed.demanded.forEach(d => {
|
|
567
594
|
const [cmd, ...aliases] = d.cmd;
|
|
568
595
|
if (d.variadic) {
|
|
569
596
|
parseOptions.array.push(cmd);
|
|
@@ -572,7 +599,7 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
572
599
|
parseOptions.alias[cmd] = aliases;
|
|
573
600
|
parseOptions.demand[cmd] = true;
|
|
574
601
|
});
|
|
575
|
-
parsed.optional.forEach(
|
|
602
|
+
parsed.optional.forEach(o => {
|
|
576
603
|
const [cmd, ...aliases] = o.cmd;
|
|
577
604
|
if (o.variadic) {
|
|
578
605
|
parseOptions.array.push(cmd);
|
|
@@ -593,27 +620,28 @@ function command(yargs, usage, validation, globalMiddleware = [], shim) {
|
|
|
593
620
|
frozens.push({
|
|
594
621
|
handlers,
|
|
595
622
|
aliasMap,
|
|
596
|
-
defaultCommand
|
|
623
|
+
defaultCommand,
|
|
597
624
|
});
|
|
598
625
|
};
|
|
599
626
|
self.unfreeze = () => {
|
|
600
627
|
const frozen = frozens.pop();
|
|
601
628
|
assertNotStrictEqual(frozen, undefined, shim);
|
|
602
|
-
({
|
|
603
|
-
handlers,
|
|
604
|
-
aliasMap,
|
|
605
|
-
defaultCommand
|
|
606
|
-
} = frozen);
|
|
629
|
+
({ handlers, aliasMap, defaultCommand } = frozen);
|
|
607
630
|
};
|
|
608
631
|
return self;
|
|
609
632
|
}
|
|
610
|
-
function isCommandHandlerDefinition(cmd) {
|
|
611
|
-
return typeof cmd === 'object';
|
|
612
|
-
}
|
|
613
633
|
function isCommandBuilderDefinition(builder) {
|
|
614
|
-
return typeof builder === 'object' &&
|
|
634
|
+
return (typeof builder === 'object' &&
|
|
615
635
|
!!builder.builder &&
|
|
616
|
-
typeof builder.handler === 'function';
|
|
636
|
+
typeof builder.handler === 'function');
|
|
637
|
+
}
|
|
638
|
+
function isCommandAndAliases(cmd) {
|
|
639
|
+
if (cmd.every(c => typeof c === 'string')) {
|
|
640
|
+
return true;
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
617
645
|
}
|
|
618
646
|
function isCommandBuilderCallback(builder) {
|
|
619
647
|
return typeof builder === 'function';
|
|
@@ -621,13 +649,18 @@ function isCommandBuilderCallback(builder) {
|
|
|
621
649
|
function isCommandBuilderOptionDefinitions(builder) {
|
|
622
650
|
return typeof builder === 'object';
|
|
623
651
|
}
|
|
652
|
+
function isCommandHandlerDefinition(cmd) {
|
|
653
|
+
return typeof cmd === 'object' && !Array.isArray(cmd);
|
|
654
|
+
}
|
|
624
655
|
|
|
625
656
|
function setBlocking(blocking) {
|
|
626
657
|
if (typeof process === 'undefined')
|
|
627
658
|
return;
|
|
628
|
-
[process.stdout, process.stderr].forEach(
|
|
659
|
+
[process.stdout, process.stderr].forEach(_stream => {
|
|
629
660
|
const stream = _stream;
|
|
630
|
-
if (stream._handle &&
|
|
661
|
+
if (stream._handle &&
|
|
662
|
+
stream.isTTY &&
|
|
663
|
+
typeof stream._handle.setBlocking === 'function') {
|
|
631
664
|
stream._handle.setBlocking(blocking);
|
|
632
665
|
}
|
|
633
666
|
});
|
|
@@ -716,7 +749,7 @@ function usage(yargs, y18n, shim) {
|
|
|
716
749
|
let commands = [];
|
|
717
750
|
self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
|
|
718
751
|
if (isDefault) {
|
|
719
|
-
commands = commands.map(
|
|
752
|
+
commands = commands.map(cmdArray => {
|
|
720
753
|
cmdArray[2] = false;
|
|
721
754
|
return cmdArray;
|
|
722
755
|
});
|
|
@@ -727,12 +760,12 @@ function usage(yargs, y18n, shim) {
|
|
|
727
760
|
let descriptions = {};
|
|
728
761
|
self.describe = function describe(keyOrKeys, desc) {
|
|
729
762
|
if (Array.isArray(keyOrKeys)) {
|
|
730
|
-
keyOrKeys.forEach(
|
|
763
|
+
keyOrKeys.forEach(k => {
|
|
731
764
|
self.describe(k, desc);
|
|
732
765
|
});
|
|
733
766
|
}
|
|
734
767
|
else if (typeof keyOrKeys === 'object') {
|
|
735
|
-
Object.keys(keyOrKeys).forEach(
|
|
768
|
+
Object.keys(keyOrKeys).forEach(k => {
|
|
736
769
|
self.describe(k, keyOrKeys[k]);
|
|
737
770
|
});
|
|
738
771
|
}
|
|
@@ -742,12 +775,12 @@ function usage(yargs, y18n, shim) {
|
|
|
742
775
|
};
|
|
743
776
|
self.getDescriptions = () => descriptions;
|
|
744
777
|
let epilogs = [];
|
|
745
|
-
self.epilog =
|
|
778
|
+
self.epilog = msg => {
|
|
746
779
|
epilogs.push(msg);
|
|
747
780
|
};
|
|
748
781
|
let wrapSet = false;
|
|
749
782
|
let wrap;
|
|
750
|
-
self.wrap =
|
|
783
|
+
self.wrap = cols => {
|
|
751
784
|
wrapSet = true;
|
|
752
785
|
wrap = cols;
|
|
753
786
|
};
|
|
@@ -764,7 +797,9 @@ function usage(yargs, y18n, shim) {
|
|
|
764
797
|
if (cachedHelpMessage)
|
|
765
798
|
return cachedHelpMessage;
|
|
766
799
|
normalizeAliases();
|
|
767
|
-
const base$0 = yargs.customScriptName
|
|
800
|
+
const base$0 = yargs.customScriptName
|
|
801
|
+
? yargs.$0
|
|
802
|
+
: shim.path.basename(yargs.$0);
|
|
768
803
|
const demandedOptions = yargs.getDemandedOptions();
|
|
769
804
|
const demandedCommands = yargs.getDemandedCommands();
|
|
770
805
|
const deprecatedOptions = yargs.getDeprecatedOptions();
|
|
@@ -784,11 +819,11 @@ function usage(yargs, y18n, shim) {
|
|
|
784
819
|
const theWrap = getWrap();
|
|
785
820
|
const ui = shim.cliui({
|
|
786
821
|
width: theWrap,
|
|
787
|
-
wrap: !!theWrap
|
|
822
|
+
wrap: !!theWrap,
|
|
788
823
|
});
|
|
789
824
|
if (!usageDisabled) {
|
|
790
825
|
if (usages.length) {
|
|
791
|
-
usages.forEach(
|
|
826
|
+
usages.forEach(usage => {
|
|
792
827
|
ui.div(`${usage[0].replace(/\$0/g, base$0)}`);
|
|
793
828
|
if (usage[1]) {
|
|
794
829
|
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
|
|
@@ -810,16 +845,18 @@ function usage(yargs, y18n, shim) {
|
|
|
810
845
|
if (commands.length) {
|
|
811
846
|
ui.div(__('Commands:'));
|
|
812
847
|
const context = yargs.getContext();
|
|
813
|
-
const parentCommands = context.commands.length
|
|
848
|
+
const parentCommands = context.commands.length
|
|
849
|
+
? `${context.commands.join(' ')} `
|
|
850
|
+
: '';
|
|
814
851
|
if (yargs.getParserConfiguration()['sort-commands'] === true) {
|
|
815
852
|
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
|
816
853
|
}
|
|
817
|
-
commands.forEach(
|
|
854
|
+
commands.forEach(command => {
|
|
818
855
|
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
|
|
819
856
|
ui.span({
|
|
820
857
|
text: commandString,
|
|
821
858
|
padding: [0, 2, 0, 2],
|
|
822
|
-
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
|
859
|
+
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
|
|
823
860
|
}, { text: command[1] });
|
|
824
861
|
const hints = [];
|
|
825
862
|
if (command[2])
|
|
@@ -836,7 +873,11 @@ function usage(yargs, y18n, shim) {
|
|
|
836
873
|
}
|
|
837
874
|
}
|
|
838
875
|
if (hints.length) {
|
|
839
|
-
ui.div({
|
|
876
|
+
ui.div({
|
|
877
|
+
text: hints.join(' '),
|
|
878
|
+
padding: [0, 0, 0, 2],
|
|
879
|
+
align: 'right',
|
|
880
|
+
});
|
|
840
881
|
}
|
|
841
882
|
else {
|
|
842
883
|
ui.div();
|
|
@@ -844,9 +885,9 @@ function usage(yargs, y18n, shim) {
|
|
|
844
885
|
});
|
|
845
886
|
ui.div();
|
|
846
887
|
}
|
|
847
|
-
const aliasKeys = (Object.keys(options.alias) || [])
|
|
848
|
-
|
|
849
|
-
|
|
888
|
+
const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
|
|
889
|
+
keys = keys.filter(key => !yargs.parsed.newAliases[key] &&
|
|
890
|
+
aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
|
|
850
891
|
const defaultGroup = __('Options:');
|
|
851
892
|
if (!groups[defaultGroup])
|
|
852
893
|
groups[defaultGroup] = [];
|
|
@@ -855,7 +896,9 @@ function usage(yargs, y18n, shim) {
|
|
|
855
896
|
const displayedGroups = Object.keys(groups)
|
|
856
897
|
.filter(groupName => groups[groupName].length > 0)
|
|
857
898
|
.map(groupName => {
|
|
858
|
-
const normalizedKeys = groups[groupName]
|
|
899
|
+
const normalizedKeys = groups[groupName]
|
|
900
|
+
.filter(filterHiddenOptions)
|
|
901
|
+
.map(key => {
|
|
859
902
|
if (~aliasKeys.indexOf(key))
|
|
860
903
|
return key;
|
|
861
904
|
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
|
@@ -869,17 +912,26 @@ function usage(yargs, y18n, shim) {
|
|
|
869
912
|
.filter(({ normalizedKeys }) => normalizedKeys.length > 0)
|
|
870
913
|
.map(({ groupName, normalizedKeys }) => {
|
|
871
914
|
const switches = normalizedKeys.reduce((acc, key) => {
|
|
872
|
-
acc[key] = [key]
|
|
915
|
+
acc[key] = [key]
|
|
916
|
+
.concat(options.alias[key] || [])
|
|
873
917
|
.map(sw => {
|
|
874
918
|
if (groupName === self.getPositionalGroupName())
|
|
875
919
|
return sw;
|
|
876
920
|
else {
|
|
877
|
-
return (/^[0-9]$/.test(sw)
|
|
878
|
-
? ~options.boolean.indexOf(key)
|
|
879
|
-
|
|
921
|
+
return ((/^[0-9]$/.test(sw)
|
|
922
|
+
? ~options.boolean.indexOf(key)
|
|
923
|
+
? '-'
|
|
924
|
+
: '--'
|
|
925
|
+
: sw.length > 1
|
|
926
|
+
? '--'
|
|
927
|
+
: '-') + sw);
|
|
880
928
|
}
|
|
881
929
|
})
|
|
882
|
-
.sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
|
|
930
|
+
.sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
|
|
931
|
+
? 0
|
|
932
|
+
: isLongSwitch(sw1)
|
|
933
|
+
? 1
|
|
934
|
+
: -1)
|
|
883
935
|
.join(', ');
|
|
884
936
|
return acc;
|
|
885
937
|
}, {});
|
|
@@ -901,7 +953,7 @@ function usage(yargs, y18n, shim) {
|
|
|
901
953
|
}
|
|
902
954
|
displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
|
|
903
955
|
ui.div(groupName);
|
|
904
|
-
normalizedKeys.forEach(
|
|
956
|
+
normalizedKeys.forEach(key => {
|
|
905
957
|
const kswitch = switches[key];
|
|
906
958
|
let desc = descriptions[key] || '';
|
|
907
959
|
let type = null;
|
|
@@ -923,13 +975,23 @@ function usage(yargs, y18n, shim) {
|
|
|
923
975
|
? `[${__('deprecated: %s', deprecated)}]`
|
|
924
976
|
: `[${__('deprecated')}]`;
|
|
925
977
|
const extra = [
|
|
926
|
-
|
|
978
|
+
key in deprecatedOptions
|
|
979
|
+
? deprecatedExtra(deprecatedOptions[key])
|
|
980
|
+
: null,
|
|
927
981
|
type,
|
|
928
|
-
|
|
929
|
-
options.choices && options.choices[key]
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
982
|
+
key in demandedOptions ? `[${__('required')}]` : null,
|
|
983
|
+
options.choices && options.choices[key]
|
|
984
|
+
? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]`
|
|
985
|
+
: null,
|
|
986
|
+
defaultString(options.default[key], options.defaultDescription[key]),
|
|
987
|
+
]
|
|
988
|
+
.filter(Boolean)
|
|
989
|
+
.join(' ');
|
|
990
|
+
ui.span({
|
|
991
|
+
text: getText(kswitch),
|
|
992
|
+
padding: [0, 2, 0, 2 + getIndentation(kswitch)],
|
|
993
|
+
width: maxWidth(switches, theWrap) + 4,
|
|
994
|
+
}, desc);
|
|
933
995
|
if (extra)
|
|
934
996
|
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
|
|
935
997
|
else
|
|
@@ -939,30 +1001,32 @@ function usage(yargs, y18n, shim) {
|
|
|
939
1001
|
});
|
|
940
1002
|
if (examples.length) {
|
|
941
1003
|
ui.div(__('Examples:'));
|
|
942
|
-
examples.forEach(
|
|
1004
|
+
examples.forEach(example => {
|
|
943
1005
|
example[0] = example[0].replace(/\$0/g, base$0);
|
|
944
1006
|
});
|
|
945
|
-
examples.forEach(
|
|
1007
|
+
examples.forEach(example => {
|
|
946
1008
|
if (example[1] === '') {
|
|
947
1009
|
ui.div({
|
|
948
1010
|
text: example[0],
|
|
949
|
-
padding: [0, 2, 0, 2]
|
|
1011
|
+
padding: [0, 2, 0, 2],
|
|
950
1012
|
});
|
|
951
1013
|
}
|
|
952
1014
|
else {
|
|
953
1015
|
ui.div({
|
|
954
1016
|
text: example[0],
|
|
955
1017
|
padding: [0, 2, 0, 2],
|
|
956
|
-
width: maxWidth(examples, theWrap) + 4
|
|
1018
|
+
width: maxWidth(examples, theWrap) + 4,
|
|
957
1019
|
}, {
|
|
958
|
-
text: example[1]
|
|
1020
|
+
text: example[1],
|
|
959
1021
|
});
|
|
960
1022
|
}
|
|
961
1023
|
});
|
|
962
1024
|
ui.div();
|
|
963
1025
|
}
|
|
964
1026
|
if (epilogs.length > 0) {
|
|
965
|
-
const e = epilogs
|
|
1027
|
+
const e = epilogs
|
|
1028
|
+
.map(epilog => epilog.replace(/\$0/g, base$0))
|
|
1029
|
+
.join('\n');
|
|
966
1030
|
ui.div(`${e}\n`);
|
|
967
1031
|
}
|
|
968
1032
|
return ui.toString().replace(/\s*$/, '');
|
|
@@ -972,7 +1036,7 @@ function usage(yargs, y18n, shim) {
|
|
|
972
1036
|
if (!Array.isArray(table)) {
|
|
973
1037
|
table = Object.values(table).map(v => [v]);
|
|
974
1038
|
}
|
|
975
|
-
table.forEach(
|
|
1039
|
+
table.forEach(v => {
|
|
976
1040
|
width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
|
|
977
1041
|
});
|
|
978
1042
|
if (theWrap)
|
|
@@ -982,8 +1046,8 @@ function usage(yargs, y18n, shim) {
|
|
|
982
1046
|
function normalizeAliases() {
|
|
983
1047
|
const demandedOptions = yargs.getDemandedOptions();
|
|
984
1048
|
const options = yargs.getOptions();
|
|
985
|
-
(Object.keys(options.alias) || []).forEach(
|
|
986
|
-
options.alias[key].forEach(
|
|
1049
|
+
(Object.keys(options.alias) || []).forEach(key => {
|
|
1050
|
+
options.alias[key].forEach(alias => {
|
|
987
1051
|
if (descriptions[alias])
|
|
988
1052
|
self.describe(key, descriptions[alias]);
|
|
989
1053
|
if (alias in demandedOptions)
|
|
@@ -1013,10 +1077,10 @@ function usage(yargs, y18n, shim) {
|
|
|
1013
1077
|
function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
|
|
1014
1078
|
let groupedKeys = [];
|
|
1015
1079
|
let toCheck = null;
|
|
1016
|
-
Object.keys(groups).forEach(
|
|
1080
|
+
Object.keys(groups).forEach(group => {
|
|
1017
1081
|
groupedKeys = groupedKeys.concat(groups[group]);
|
|
1018
1082
|
});
|
|
1019
|
-
keys.forEach(
|
|
1083
|
+
keys.forEach(key => {
|
|
1020
1084
|
toCheck = [key].concat(aliases[key]);
|
|
1021
1085
|
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
|
1022
1086
|
groups[defaultGroup].push(key);
|
|
@@ -1025,7 +1089,8 @@ function usage(yargs, y18n, shim) {
|
|
|
1025
1089
|
return groupedKeys;
|
|
1026
1090
|
}
|
|
1027
1091
|
function filterHiddenOptions(key) {
|
|
1028
|
-
return yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
|
|
1092
|
+
return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
|
|
1093
|
+
yargs.parsed.argv[yargs.getOptions().showHiddenOpt]);
|
|
1029
1094
|
}
|
|
1030
1095
|
self.showHelp = (level) => {
|
|
1031
1096
|
const logger = yargs._getLoggerInstance();
|
|
@@ -1034,8 +1099,10 @@ function usage(yargs, y18n, shim) {
|
|
|
1034
1099
|
const emit = typeof level === 'function' ? level : logger[level];
|
|
1035
1100
|
emit(self.help());
|
|
1036
1101
|
};
|
|
1037
|
-
self.functionDescription =
|
|
1038
|
-
const description = fn.name
|
|
1102
|
+
self.functionDescription = fn => {
|
|
1103
|
+
const description = fn.name
|
|
1104
|
+
? shim.Parser.decamelize(fn.name, '-')
|
|
1105
|
+
: __('generated-value');
|
|
1039
1106
|
return ['(', description, ')'].join('');
|
|
1040
1107
|
};
|
|
1041
1108
|
self.stringifiedValues = function stringifiedValues(values, separator) {
|
|
@@ -1044,7 +1111,7 @@ function usage(yargs, y18n, shim) {
|
|
|
1044
1111
|
const array = [].concat(values);
|
|
1045
1112
|
if (!values || !array.length)
|
|
1046
1113
|
return string;
|
|
1047
|
-
array.forEach(
|
|
1114
|
+
array.forEach(value => {
|
|
1048
1115
|
if (string.length)
|
|
1049
1116
|
string += sep;
|
|
1050
1117
|
string += JSON.stringify(value);
|
|
@@ -1082,7 +1149,7 @@ function usage(yargs, y18n, shim) {
|
|
|
1082
1149
|
}
|
|
1083
1150
|
}
|
|
1084
1151
|
let version = null;
|
|
1085
|
-
self.version =
|
|
1152
|
+
self.version = ver => {
|
|
1086
1153
|
version = ver;
|
|
1087
1154
|
};
|
|
1088
1155
|
self.showVersion = () => {
|
|
@@ -1110,7 +1177,7 @@ function usage(yargs, y18n, shim) {
|
|
|
1110
1177
|
epilogs,
|
|
1111
1178
|
examples,
|
|
1112
1179
|
commands,
|
|
1113
|
-
descriptions
|
|
1180
|
+
descriptions,
|
|
1114
1181
|
});
|
|
1115
1182
|
};
|
|
1116
1183
|
self.unfreeze = function unfreeze() {
|
|
@@ -1124,7 +1191,7 @@ function usage(yargs, y18n, shim) {
|
|
|
1124
1191
|
epilogs,
|
|
1125
1192
|
examples,
|
|
1126
1193
|
commands,
|
|
1127
|
-
descriptions
|
|
1194
|
+
descriptions,
|
|
1128
1195
|
} = frozen);
|
|
1129
1196
|
};
|
|
1130
1197
|
return self;
|
|
@@ -1194,7 +1261,7 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
|
1194
1261
|
|
|
1195
1262
|
function completion(yargs, usage, command, shim) {
|
|
1196
1263
|
const self = {
|
|
1197
|
-
completionKey: 'get-yargs-completions'
|
|
1264
|
+
completionKey: 'get-yargs-completions',
|
|
1198
1265
|
};
|
|
1199
1266
|
let aliases;
|
|
1200
1267
|
self.setParsed = function setParsed(parsed) {
|
|
@@ -1212,22 +1279,30 @@ function completion(yargs, usage, command, shim) {
|
|
|
1212
1279
|
if (isSyncCompletionFunction(completionFunction)) {
|
|
1213
1280
|
const result = completionFunction(current, argv);
|
|
1214
1281
|
if (isPromise(result)) {
|
|
1215
|
-
return result
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1282
|
+
return result
|
|
1283
|
+
.then(list => {
|
|
1284
|
+
shim.process.nextTick(() => {
|
|
1285
|
+
done(list);
|
|
1286
|
+
});
|
|
1287
|
+
})
|
|
1288
|
+
.catch(err => {
|
|
1289
|
+
shim.process.nextTick(() => {
|
|
1290
|
+
throw err;
|
|
1291
|
+
});
|
|
1219
1292
|
});
|
|
1220
1293
|
}
|
|
1221
1294
|
return done(result);
|
|
1222
1295
|
}
|
|
1223
1296
|
else {
|
|
1224
|
-
return completionFunction(current, argv,
|
|
1297
|
+
return completionFunction(current, argv, completions => {
|
|
1225
1298
|
done(completions);
|
|
1226
1299
|
});
|
|
1227
1300
|
}
|
|
1228
1301
|
}
|
|
1229
1302
|
if (completionFunction) {
|
|
1230
|
-
return isPromise(argv)
|
|
1303
|
+
return isPromise(argv)
|
|
1304
|
+
? argv.then(runCompletionFunction)
|
|
1305
|
+
: runCompletionFunction(argv);
|
|
1231
1306
|
}
|
|
1232
1307
|
const handlers = command.getCommandHandlers();
|
|
1233
1308
|
for (let i = 0, ii = args.length; i < ii; ++i) {
|
|
@@ -1240,8 +1315,9 @@ function completion(yargs, usage, command, shim) {
|
|
|
1240
1315
|
}
|
|
1241
1316
|
}
|
|
1242
1317
|
}
|
|
1243
|
-
if (!current.match(/^-/) &&
|
|
1244
|
-
|
|
1318
|
+
if (!current.match(/^-/) &&
|
|
1319
|
+
parentCommands[parentCommands.length - 1] !== current) {
|
|
1320
|
+
usage.getCommands().forEach(usageCommand => {
|
|
1245
1321
|
const commandName = parseCommand(usageCommand[0]).cmd;
|
|
1246
1322
|
if (args.indexOf(commandName) === -1) {
|
|
1247
1323
|
if (!zshShell) {
|
|
@@ -1257,8 +1333,9 @@ function completion(yargs, usage, command, shim) {
|
|
|
1257
1333
|
if (current.match(/^-/) || (current === '' && completions.length === 0)) {
|
|
1258
1334
|
const descs = usage.getDescriptions();
|
|
1259
1335
|
const options = yargs.getOptions();
|
|
1260
|
-
Object.keys(options.key).forEach(
|
|
1261
|
-
const negable = !!options.configuration['boolean-negation'] &&
|
|
1336
|
+
Object.keys(options.key).forEach(key => {
|
|
1337
|
+
const negable = !!options.configuration['boolean-negation'] &&
|
|
1338
|
+
options.boolean.includes(key);
|
|
1262
1339
|
let keyAndAliases = [key].concat(aliases[key] || []);
|
|
1263
1340
|
if (negable)
|
|
1264
1341
|
keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`));
|
|
@@ -1273,7 +1350,8 @@ function completion(yargs, usage, command, shim) {
|
|
|
1273
1350
|
}
|
|
1274
1351
|
else {
|
|
1275
1352
|
const desc = descs[key] || '';
|
|
1276
|
-
completions.push(dashes +
|
|
1353
|
+
completions.push(dashes +
|
|
1354
|
+
`${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`);
|
|
1277
1355
|
}
|
|
1278
1356
|
}
|
|
1279
1357
|
}
|
|
@@ -1285,7 +1363,9 @@ function completion(yargs, usage, command, shim) {
|
|
|
1285
1363
|
done(completions);
|
|
1286
1364
|
};
|
|
1287
1365
|
self.generateCompletionScript = function generateCompletionScript($0, cmd) {
|
|
1288
|
-
let script = zshShell
|
|
1366
|
+
let script = zshShell
|
|
1367
|
+
? completionZshTemplate
|
|
1368
|
+
: completionShTemplate;
|
|
1289
1369
|
const name = shim.path.basename($0);
|
|
1290
1370
|
if ($0.match(/\.js$/))
|
|
1291
1371
|
$0 = `./${$0}`;
|
|
@@ -1294,7 +1374,7 @@ function completion(yargs, usage, command, shim) {
|
|
|
1294
1374
|
return script.replace(/{{app_path}}/g, $0);
|
|
1295
1375
|
};
|
|
1296
1376
|
let completionFunction = null;
|
|
1297
|
-
self.registerFunction =
|
|
1377
|
+
self.registerFunction = fn => {
|
|
1298
1378
|
completionFunction = fn;
|
|
1299
1379
|
};
|
|
1300
1380
|
return self;
|
|
@@ -1337,12 +1417,16 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1337
1417
|
const self = {};
|
|
1338
1418
|
self.nonOptionCount = function nonOptionCount(argv) {
|
|
1339
1419
|
const demandedCommands = yargs.getDemandedCommands();
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1420
|
+
const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0);
|
|
1421
|
+
const _s = positionalCount - yargs.getContext().commands.length;
|
|
1422
|
+
if (demandedCommands._ &&
|
|
1423
|
+
(_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
|
1342
1424
|
if (_s < demandedCommands._.min) {
|
|
1343
1425
|
if (demandedCommands._.minMsg !== undefined) {
|
|
1344
1426
|
usage.fail(demandedCommands._.minMsg
|
|
1345
|
-
? demandedCommands._.minMsg
|
|
1427
|
+
? demandedCommands._.minMsg
|
|
1428
|
+
.replace(/\$0/g, _s.toString())
|
|
1429
|
+
.replace(/\$1/, demandedCommands._.min.toString())
|
|
1346
1430
|
: null);
|
|
1347
1431
|
}
|
|
1348
1432
|
else {
|
|
@@ -1352,7 +1436,9 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1352
1436
|
else if (_s > demandedCommands._.max) {
|
|
1353
1437
|
if (demandedCommands._.maxMsg !== undefined) {
|
|
1354
1438
|
usage.fail(demandedCommands._.maxMsg
|
|
1355
|
-
? demandedCommands._.maxMsg
|
|
1439
|
+
? demandedCommands._.maxMsg
|
|
1440
|
+
.replace(/\$0/g, _s.toString())
|
|
1441
|
+
.replace(/\$1/, demandedCommands._.max.toString())
|
|
1356
1442
|
: null);
|
|
1357
1443
|
}
|
|
1358
1444
|
else {
|
|
@@ -1370,7 +1456,8 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1370
1456
|
const demandedOptions = yargs.getDemandedOptions();
|
|
1371
1457
|
let missing = null;
|
|
1372
1458
|
for (const key of Object.keys(demandedOptions)) {
|
|
1373
|
-
if (!Object.prototype.hasOwnProperty.call(argv, key) ||
|
|
1459
|
+
if (!Object.prototype.hasOwnProperty.call(argv, key) ||
|
|
1460
|
+
typeof argv[key] === 'undefined') {
|
|
1374
1461
|
missing = missing || {};
|
|
1375
1462
|
missing[key] = demandedOptions[key];
|
|
1376
1463
|
}
|
|
@@ -1391,7 +1478,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1391
1478
|
const commandKeys = yargs.getCommandInstance().getCommands();
|
|
1392
1479
|
const unknown = [];
|
|
1393
1480
|
const currentContext = yargs.getContext();
|
|
1394
|
-
Object.keys(argv).forEach(
|
|
1481
|
+
Object.keys(argv).forEach(key => {
|
|
1395
1482
|
if (specialKeys.indexOf(key) === -1 &&
|
|
1396
1483
|
!Object.prototype.hasOwnProperty.call(positionalMap, key) &&
|
|
1397
1484
|
!Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) &&
|
|
@@ -1399,8 +1486,11 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1399
1486
|
unknown.push(key);
|
|
1400
1487
|
}
|
|
1401
1488
|
});
|
|
1402
|
-
if (checkPositionals &&
|
|
1403
|
-
|
|
1489
|
+
if (checkPositionals &&
|
|
1490
|
+
(currentContext.commands.length > 0 ||
|
|
1491
|
+
commandKeys.length > 0 ||
|
|
1492
|
+
isDefaultCommand)) {
|
|
1493
|
+
argv._.slice(currentContext.commands.length).forEach(key => {
|
|
1404
1494
|
if (commandKeys.indexOf('' + key) === -1) {
|
|
1405
1495
|
unknown.push('' + key);
|
|
1406
1496
|
}
|
|
@@ -1414,8 +1504,8 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1414
1504
|
const commandKeys = yargs.getCommandInstance().getCommands();
|
|
1415
1505
|
const unknown = [];
|
|
1416
1506
|
const currentContext = yargs.getContext();
|
|
1417
|
-
if (
|
|
1418
|
-
argv._.slice(currentContext.commands.length).forEach(
|
|
1507
|
+
if (currentContext.commands.length > 0 || commandKeys.length > 0) {
|
|
1508
|
+
argv._.slice(currentContext.commands.length).forEach(key => {
|
|
1419
1509
|
if (commandKeys.indexOf('' + key) === -1) {
|
|
1420
1510
|
unknown.push('' + key);
|
|
1421
1511
|
}
|
|
@@ -1435,7 +1525,8 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1435
1525
|
}
|
|
1436
1526
|
const newAliases = yargs.parsed.newAliases;
|
|
1437
1527
|
for (const a of [key, ...aliases[key]]) {
|
|
1438
|
-
if (!Object.prototype.hasOwnProperty.call(newAliases, a) ||
|
|
1528
|
+
if (!Object.prototype.hasOwnProperty.call(newAliases, a) ||
|
|
1529
|
+
!newAliases[key]) {
|
|
1439
1530
|
return true;
|
|
1440
1531
|
}
|
|
1441
1532
|
}
|
|
@@ -1446,10 +1537,10 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1446
1537
|
const invalid = {};
|
|
1447
1538
|
if (!Object.keys(options.choices).length)
|
|
1448
1539
|
return;
|
|
1449
|
-
Object.keys(argv).forEach(
|
|
1540
|
+
Object.keys(argv).forEach(key => {
|
|
1450
1541
|
if (specialKeys.indexOf(key) === -1 &&
|
|
1451
1542
|
Object.prototype.hasOwnProperty.call(options.choices, key)) {
|
|
1452
|
-
[].concat(argv[key]).forEach(
|
|
1543
|
+
[].concat(argv[key]).forEach(value => {
|
|
1453
1544
|
if (options.choices[key].indexOf(value) === -1 &&
|
|
1454
1545
|
value !== undefined) {
|
|
1455
1546
|
invalid[key] = (invalid[key] || []).concat(value);
|
|
@@ -1461,7 +1552,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1461
1552
|
if (!invalidKeys.length)
|
|
1462
1553
|
return;
|
|
1463
1554
|
let msg = __('Invalid values:');
|
|
1464
|
-
invalidKeys.forEach(
|
|
1555
|
+
invalidKeys.forEach(key => {
|
|
1465
1556
|
msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
|
|
1466
1557
|
});
|
|
1467
1558
|
usage.fail(msg);
|
|
@@ -1470,7 +1561,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1470
1561
|
self.check = function check(f, global) {
|
|
1471
1562
|
checks.push({
|
|
1472
1563
|
func: f,
|
|
1473
|
-
global
|
|
1564
|
+
global,
|
|
1474
1565
|
});
|
|
1475
1566
|
};
|
|
1476
1567
|
self.customChecks = function customChecks(argv, aliases) {
|
|
@@ -1496,7 +1587,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1496
1587
|
self.implies = function implies(key, value) {
|
|
1497
1588
|
argsert('<string|object> [array|number|string]', [key, value], arguments.length);
|
|
1498
1589
|
if (typeof key === 'object') {
|
|
1499
|
-
Object.keys(key).forEach(
|
|
1590
|
+
Object.keys(key).forEach(k => {
|
|
1500
1591
|
self.implies(k, key[k]);
|
|
1501
1592
|
});
|
|
1502
1593
|
}
|
|
@@ -1506,7 +1597,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1506
1597
|
implied[key] = [];
|
|
1507
1598
|
}
|
|
1508
1599
|
if (Array.isArray(value)) {
|
|
1509
|
-
value.forEach(
|
|
1600
|
+
value.forEach(i => self.implies(key, i));
|
|
1510
1601
|
}
|
|
1511
1602
|
else {
|
|
1512
1603
|
assertNotStrictEqual(value, undefined, shim);
|
|
@@ -1534,9 +1625,9 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1534
1625
|
}
|
|
1535
1626
|
self.implications = function implications(argv) {
|
|
1536
1627
|
const implyFail = [];
|
|
1537
|
-
Object.keys(implied).forEach(
|
|
1628
|
+
Object.keys(implied).forEach(key => {
|
|
1538
1629
|
const origKey = key;
|
|
1539
|
-
(implied[key] || []).forEach(
|
|
1630
|
+
(implied[key] || []).forEach(value => {
|
|
1540
1631
|
let key = origKey;
|
|
1541
1632
|
const origValue = value;
|
|
1542
1633
|
key = keyExists(argv, key);
|
|
@@ -1548,8 +1639,8 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1548
1639
|
});
|
|
1549
1640
|
if (implyFail.length) {
|
|
1550
1641
|
let msg = `${__('Implications failed:')}\n`;
|
|
1551
|
-
implyFail.forEach(
|
|
1552
|
-
msg +=
|
|
1642
|
+
implyFail.forEach(value => {
|
|
1643
|
+
msg += value;
|
|
1553
1644
|
});
|
|
1554
1645
|
usage.fail(msg);
|
|
1555
1646
|
}
|
|
@@ -1558,7 +1649,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1558
1649
|
self.conflicts = function conflicts(key, value) {
|
|
1559
1650
|
argsert('<string|object> [array|string]', [key, value], arguments.length);
|
|
1560
1651
|
if (typeof key === 'object') {
|
|
1561
|
-
Object.keys(key).forEach(
|
|
1652
|
+
Object.keys(key).forEach(k => {
|
|
1562
1653
|
self.conflicts(k, key[k]);
|
|
1563
1654
|
});
|
|
1564
1655
|
}
|
|
@@ -1568,7 +1659,7 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1568
1659
|
conflicting[key] = [];
|
|
1569
1660
|
}
|
|
1570
1661
|
if (Array.isArray(value)) {
|
|
1571
|
-
value.forEach(
|
|
1662
|
+
value.forEach(i => self.conflicts(key, i));
|
|
1572
1663
|
}
|
|
1573
1664
|
else {
|
|
1574
1665
|
conflicting[key].push(value);
|
|
@@ -1577,9 +1668,9 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1577
1668
|
};
|
|
1578
1669
|
self.getConflicting = () => conflicting;
|
|
1579
1670
|
self.conflicting = function conflictingFn(argv) {
|
|
1580
|
-
Object.keys(argv).forEach(
|
|
1671
|
+
Object.keys(argv).forEach(key => {
|
|
1581
1672
|
if (conflicting[key]) {
|
|
1582
|
-
conflicting[key].forEach(
|
|
1673
|
+
conflicting[key].forEach(value => {
|
|
1583
1674
|
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
|
1584
1675
|
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
|
|
1585
1676
|
}
|
|
@@ -1613,17 +1704,13 @@ function validation(yargs, usage, y18n, shim) {
|
|
|
1613
1704
|
frozens.push({
|
|
1614
1705
|
implied,
|
|
1615
1706
|
checks,
|
|
1616
|
-
conflicting
|
|
1707
|
+
conflicting,
|
|
1617
1708
|
});
|
|
1618
1709
|
};
|
|
1619
1710
|
self.unfreeze = function unfreeze() {
|
|
1620
1711
|
const frozen = frozens.pop();
|
|
1621
1712
|
assertNotStrictEqual(frozen, undefined, shim);
|
|
1622
|
-
({
|
|
1623
|
-
implied,
|
|
1624
|
-
checks,
|
|
1625
|
-
conflicting
|
|
1626
|
-
} = frozen);
|
|
1713
|
+
({ implied, checks, conflicting } = frozen);
|
|
1627
1714
|
};
|
|
1628
1715
|
return self;
|
|
1629
1716
|
}
|
|
@@ -1663,23 +1750,52 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1663
1750
|
const b = rebase(cwd, x);
|
|
1664
1751
|
return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x;
|
|
1665
1752
|
})
|
|
1666
|
-
.join(' ')
|
|
1753
|
+
.join(' ')
|
|
1754
|
+
.trim();
|
|
1667
1755
|
if (shim$1.getEnv('_') && shim$1.getProcessArgvBin() === shim$1.getEnv('_')) {
|
|
1668
|
-
self.$0 = shim$1
|
|
1756
|
+
self.$0 = shim$1
|
|
1757
|
+
.getEnv('_')
|
|
1758
|
+
.replace(`${shim$1.path.dirname(shim$1.process.execPath())}/`, '');
|
|
1669
1759
|
}
|
|
1670
1760
|
const context = { resets: -1, commands: [], fullCommands: [], files: [] };
|
|
1671
1761
|
self.getContext = () => context;
|
|
1762
|
+
let hasOutput = false;
|
|
1763
|
+
let exitError = null;
|
|
1764
|
+
self.exit = (code, err) => {
|
|
1765
|
+
hasOutput = true;
|
|
1766
|
+
exitError = err;
|
|
1767
|
+
if (exitProcess)
|
|
1768
|
+
shim$1.process.exit(code);
|
|
1769
|
+
};
|
|
1770
|
+
let completionCommand = null;
|
|
1771
|
+
self.completion = function (cmd, desc, fn) {
|
|
1772
|
+
argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length);
|
|
1773
|
+
if (typeof desc === 'function') {
|
|
1774
|
+
fn = desc;
|
|
1775
|
+
desc = undefined;
|
|
1776
|
+
}
|
|
1777
|
+
completionCommand = cmd || completionCommand || 'completion';
|
|
1778
|
+
if (!desc && desc !== false) {
|
|
1779
|
+
desc = 'generate completion script';
|
|
1780
|
+
}
|
|
1781
|
+
self.command(completionCommand, desc);
|
|
1782
|
+
if (fn)
|
|
1783
|
+
completion$1.registerFunction(fn);
|
|
1784
|
+
return self;
|
|
1785
|
+
};
|
|
1672
1786
|
let options;
|
|
1673
1787
|
self.resetOptions = self.reset = function resetOptions(aliases = {}) {
|
|
1674
1788
|
context.resets++;
|
|
1675
1789
|
options = options || {};
|
|
1676
1790
|
const tmpOptions = {};
|
|
1677
1791
|
tmpOptions.local = options.local ? options.local : [];
|
|
1678
|
-
tmpOptions.configObjects = options.configObjects
|
|
1792
|
+
tmpOptions.configObjects = options.configObjects
|
|
1793
|
+
? options.configObjects
|
|
1794
|
+
: [];
|
|
1679
1795
|
const localLookup = {};
|
|
1680
|
-
tmpOptions.local.forEach(
|
|
1796
|
+
tmpOptions.local.forEach(l => {
|
|
1681
1797
|
localLookup[l] = true;
|
|
1682
|
-
(aliases[l] || []).forEach(
|
|
1798
|
+
(aliases[l] || []).forEach(a => {
|
|
1683
1799
|
localLookup[a] = true;
|
|
1684
1800
|
});
|
|
1685
1801
|
});
|
|
@@ -1692,14 +1808,27 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1692
1808
|
}, {}));
|
|
1693
1809
|
groups = {};
|
|
1694
1810
|
const arrayOptions = [
|
|
1695
|
-
'array',
|
|
1696
|
-
'
|
|
1697
|
-
'
|
|
1811
|
+
'array',
|
|
1812
|
+
'boolean',
|
|
1813
|
+
'string',
|
|
1814
|
+
'skipValidation',
|
|
1815
|
+
'count',
|
|
1816
|
+
'normalize',
|
|
1817
|
+
'number',
|
|
1818
|
+
'hiddenOptions',
|
|
1698
1819
|
];
|
|
1699
1820
|
const objectOptions = [
|
|
1700
|
-
'narg',
|
|
1701
|
-
'
|
|
1702
|
-
'
|
|
1821
|
+
'narg',
|
|
1822
|
+
'key',
|
|
1823
|
+
'alias',
|
|
1824
|
+
'default',
|
|
1825
|
+
'defaultDescription',
|
|
1826
|
+
'config',
|
|
1827
|
+
'choices',
|
|
1828
|
+
'demandedOptions',
|
|
1829
|
+
'demandedCommands',
|
|
1830
|
+
'coerce',
|
|
1831
|
+
'deprecatedOptions',
|
|
1703
1832
|
];
|
|
1704
1833
|
arrayOptions.forEach(k => {
|
|
1705
1834
|
tmpOptions[k] = (options[k] || []).filter((k) => !localLookup[k]);
|
|
@@ -1710,8 +1839,12 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1710
1839
|
tmpOptions.envPrefix = options.envPrefix;
|
|
1711
1840
|
options = tmpOptions;
|
|
1712
1841
|
usage$1 = usage$1 ? usage$1.reset(localLookup) : usage(self, y18n, shim$1);
|
|
1713
|
-
validation$1 = validation$1
|
|
1714
|
-
|
|
1842
|
+
validation$1 = validation$1
|
|
1843
|
+
? validation$1.reset(localLookup)
|
|
1844
|
+
: validation(self, usage$1, y18n, shim$1);
|
|
1845
|
+
command$1 = command$1
|
|
1846
|
+
? command$1.reset()
|
|
1847
|
+
: command(self, usage$1, validation$1, globalMiddleware, shim$1);
|
|
1715
1848
|
if (!completion$1)
|
|
1716
1849
|
completion$1 = completion(self, usage$1, command$1, shim$1);
|
|
1717
1850
|
completionCommand = null;
|
|
@@ -1739,7 +1872,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1739
1872
|
parsed: self.parsed,
|
|
1740
1873
|
parseFn,
|
|
1741
1874
|
parseContext,
|
|
1742
|
-
handlerFinishCommand
|
|
1875
|
+
handlerFinishCommand,
|
|
1743
1876
|
});
|
|
1744
1877
|
usage$1.freeze();
|
|
1745
1878
|
validation$1.freeze();
|
|
@@ -1764,7 +1897,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1764
1897
|
completionCommand,
|
|
1765
1898
|
parseFn,
|
|
1766
1899
|
parseContext,
|
|
1767
|
-
handlerFinishCommand
|
|
1900
|
+
handlerFinishCommand,
|
|
1768
1901
|
} = frozen);
|
|
1769
1902
|
options.configObjects = configObjects;
|
|
1770
1903
|
usage$1.unfreeze();
|
|
@@ -1818,7 +1951,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1818
1951
|
};
|
|
1819
1952
|
function populateParserHintArray(type, keys) {
|
|
1820
1953
|
keys = [].concat(keys);
|
|
1821
|
-
keys.forEach(
|
|
1954
|
+
keys.forEach(key => {
|
|
1822
1955
|
key = sanitizeKey(key);
|
|
1823
1956
|
options[type].push(key);
|
|
1824
1957
|
});
|
|
@@ -1886,7 +2019,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1886
2019
|
}
|
|
1887
2020
|
function populateParserHintDictionary(builder, type, key, value, singleKeyHandler) {
|
|
1888
2021
|
if (Array.isArray(key)) {
|
|
1889
|
-
key.forEach(
|
|
2022
|
+
key.forEach(k => {
|
|
1890
2023
|
builder(k, value);
|
|
1891
2024
|
});
|
|
1892
2025
|
}
|
|
@@ -1921,7 +2054,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1921
2054
|
}
|
|
1922
2055
|
self.config = function config(key = 'config', msg, parseFn) {
|
|
1923
2056
|
argsert('[object|string] [string|function] [function]', [key, msg, parseFn], arguments.length);
|
|
1924
|
-
if (
|
|
2057
|
+
if (typeof key === 'object' && !Array.isArray(key)) {
|
|
1925
2058
|
key = applyExtends(key, cwd, self.getParserConfiguration()['deep-merge-config'] || false, shim$1);
|
|
1926
2059
|
options.configObjects = (options.configObjects || []).concat(key);
|
|
1927
2060
|
return self;
|
|
@@ -1931,7 +2064,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1931
2064
|
msg = undefined;
|
|
1932
2065
|
}
|
|
1933
2066
|
self.describe(key, msg || usage$1.deferY18nLookup('Path to JSON config file'));
|
|
1934
|
-
(Array.isArray(key) ? key : [key]).forEach(
|
|
2067
|
+
(Array.isArray(key) ? key : [key]).forEach(k => {
|
|
1935
2068
|
options.config[k] = parseFn || true;
|
|
1936
2069
|
});
|
|
1937
2070
|
return self;
|
|
@@ -1939,7 +2072,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1939
2072
|
self.example = function (cmd, description) {
|
|
1940
2073
|
argsert('<string|array> [string]', [cmd, description], arguments.length);
|
|
1941
2074
|
if (Array.isArray(cmd)) {
|
|
1942
|
-
cmd.forEach(
|
|
2075
|
+
cmd.forEach(exampleParams => self.example(...exampleParams));
|
|
1943
2076
|
}
|
|
1944
2077
|
else {
|
|
1945
2078
|
usage$1.example(cmd, description);
|
|
@@ -1959,7 +2092,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1959
2092
|
};
|
|
1960
2093
|
self.demand = self.required = self.require = function demand(keys, max, msg) {
|
|
1961
2094
|
if (Array.isArray(max)) {
|
|
1962
|
-
max.forEach(
|
|
2095
|
+
max.forEach(key => {
|
|
1963
2096
|
assertNotStrictEqual(msg, true, shim$1);
|
|
1964
2097
|
demandOption(key, msg);
|
|
1965
2098
|
});
|
|
@@ -1974,7 +2107,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
1974
2107
|
self.demandCommand(keys, max, msg, msg);
|
|
1975
2108
|
}
|
|
1976
2109
|
else if (Array.isArray(keys)) {
|
|
1977
|
-
keys.forEach(
|
|
2110
|
+
keys.forEach(key => {
|
|
1978
2111
|
assertNotStrictEqual(msg, true, shim$1);
|
|
1979
2112
|
demandOption(key, msg);
|
|
1980
2113
|
});
|
|
@@ -2000,7 +2133,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2000
2133
|
min,
|
|
2001
2134
|
max,
|
|
2002
2135
|
minMsg,
|
|
2003
|
-
maxMsg
|
|
2136
|
+
maxMsg,
|
|
2004
2137
|
};
|
|
2005
2138
|
return self;
|
|
2006
2139
|
};
|
|
@@ -2075,7 +2208,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2075
2208
|
options.local = options.local.filter(l => globals.indexOf(l) === -1);
|
|
2076
2209
|
}
|
|
2077
2210
|
else {
|
|
2078
|
-
globals.forEach(
|
|
2211
|
+
globals.forEach(g => {
|
|
2079
2212
|
if (options.local.indexOf(g) === -1)
|
|
2080
2213
|
options.local.push(g);
|
|
2081
2214
|
});
|
|
@@ -2114,7 +2247,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2114
2247
|
assertNotStrictEqual(pkgJsonPath, undefined, shim$1);
|
|
2115
2248
|
obj = JSON.parse(shim$1.readFileSync(pkgJsonPath, 'utf8'));
|
|
2116
2249
|
}
|
|
2117
|
-
catch (
|
|
2250
|
+
catch (_noop) { }
|
|
2118
2251
|
pkgs[npath] = obj || {};
|
|
2119
2252
|
return pkgs[npath];
|
|
2120
2253
|
}
|
|
@@ -2154,7 +2287,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2154
2287
|
self.option = self.options = function option(key, opt) {
|
|
2155
2288
|
argsert('<string|object> [object]', [key, opt], arguments.length);
|
|
2156
2289
|
if (typeof key === 'object') {
|
|
2157
|
-
Object.keys(key).forEach(
|
|
2290
|
+
Object.keys(key).forEach(k => {
|
|
2158
2291
|
self.options(k, key[k]);
|
|
2159
2292
|
});
|
|
2160
2293
|
}
|
|
@@ -2252,9 +2385,20 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2252
2385
|
if (context.resets === 0) {
|
|
2253
2386
|
throw new YError(".positional() can only be called in a command's builder function");
|
|
2254
2387
|
}
|
|
2255
|
-
const supportedOpts = [
|
|
2256
|
-
'
|
|
2257
|
-
'
|
|
2388
|
+
const supportedOpts = [
|
|
2389
|
+
'default',
|
|
2390
|
+
'defaultDescription',
|
|
2391
|
+
'implies',
|
|
2392
|
+
'normalize',
|
|
2393
|
+
'choices',
|
|
2394
|
+
'conflicts',
|
|
2395
|
+
'coerce',
|
|
2396
|
+
'type',
|
|
2397
|
+
'describe',
|
|
2398
|
+
'desc',
|
|
2399
|
+
'description',
|
|
2400
|
+
'alias',
|
|
2401
|
+
];
|
|
2258
2402
|
opts = objFilter(opts, (k, v) => {
|
|
2259
2403
|
let accept = supportedOpts.indexOf(k) !== -1;
|
|
2260
2404
|
if (k === 'type' && ['string', 'number', 'boolean'].indexOf(v) === -1)
|
|
@@ -2262,13 +2406,15 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2262
2406
|
return accept;
|
|
2263
2407
|
});
|
|
2264
2408
|
const fullCommand = context.fullCommands[context.fullCommands.length - 1];
|
|
2265
|
-
const parseOptions = fullCommand
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2409
|
+
const parseOptions = fullCommand
|
|
2410
|
+
? command$1.cmdToParseOptions(fullCommand)
|
|
2411
|
+
: {
|
|
2412
|
+
array: [],
|
|
2413
|
+
alias: {},
|
|
2414
|
+
default: {},
|
|
2415
|
+
demand: {},
|
|
2416
|
+
};
|
|
2417
|
+
objectKeys(parseOptions).forEach(pk => {
|
|
2272
2418
|
const parseOption = parseOptions[pk];
|
|
2273
2419
|
if (Array.isArray(parseOption)) {
|
|
2274
2420
|
if (parseOption.indexOf(key) !== -1)
|
|
@@ -2289,7 +2435,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2289
2435
|
delete preservedGroups[groupName];
|
|
2290
2436
|
}
|
|
2291
2437
|
const seen = {};
|
|
2292
|
-
groups[groupName] = (existing || []).concat(opts).filter(
|
|
2438
|
+
groups[groupName] = (existing || []).concat(opts).filter(key => {
|
|
2293
2439
|
if (seen[key])
|
|
2294
2440
|
return false;
|
|
2295
2441
|
return (seen[key] = true);
|
|
@@ -2425,29 +2571,13 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2425
2571
|
usage$1.showHelpOnFail(enabled, message);
|
|
2426
2572
|
return self;
|
|
2427
2573
|
};
|
|
2428
|
-
|
|
2574
|
+
let exitProcess = true;
|
|
2429
2575
|
self.exitProcess = function (enabled = true) {
|
|
2430
2576
|
argsert('[boolean]', [enabled], arguments.length);
|
|
2431
2577
|
exitProcess = enabled;
|
|
2432
2578
|
return self;
|
|
2433
2579
|
};
|
|
2434
2580
|
self.getExitProcess = () => exitProcess;
|
|
2435
|
-
var completionCommand = null;
|
|
2436
|
-
self.completion = function (cmd, desc, fn) {
|
|
2437
|
-
argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length);
|
|
2438
|
-
if (typeof desc === 'function') {
|
|
2439
|
-
fn = desc;
|
|
2440
|
-
desc = undefined;
|
|
2441
|
-
}
|
|
2442
|
-
completionCommand = cmd || completionCommand || 'completion';
|
|
2443
|
-
if (!desc && desc !== false) {
|
|
2444
|
-
desc = 'generate completion script';
|
|
2445
|
-
}
|
|
2446
|
-
self.command(completionCommand, desc);
|
|
2447
|
-
if (fn)
|
|
2448
|
-
completion$1.registerFunction(fn);
|
|
2449
|
-
return self;
|
|
2450
|
-
};
|
|
2451
2581
|
self.showCompletionScript = function ($0, cmd) {
|
|
2452
2582
|
argsert('[string] [string]', [$0, cmd], arguments.length);
|
|
2453
2583
|
$0 = $0 || self.$0;
|
|
@@ -2481,14 +2611,6 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2481
2611
|
return self;
|
|
2482
2612
|
};
|
|
2483
2613
|
self.getDetectLocale = () => detectLocale;
|
|
2484
|
-
var hasOutput = false;
|
|
2485
|
-
var exitError = null;
|
|
2486
|
-
self.exit = (code, err) => {
|
|
2487
|
-
hasOutput = true;
|
|
2488
|
-
exitError = err;
|
|
2489
|
-
if (exitProcess)
|
|
2490
|
-
shim$1.process.exit(code);
|
|
2491
|
-
};
|
|
2492
2614
|
const _logger = {
|
|
2493
2615
|
log(...args) {
|
|
2494
2616
|
if (!self._hasParseCallback())
|
|
@@ -2505,7 +2627,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2505
2627
|
if (output.length)
|
|
2506
2628
|
output += '\n';
|
|
2507
2629
|
output += args.join(' ');
|
|
2508
|
-
}
|
|
2630
|
+
},
|
|
2509
2631
|
};
|
|
2510
2632
|
self._getLoggerInstance = () => _logger;
|
|
2511
2633
|
self._hasOutput = () => hasOutput;
|
|
@@ -2527,7 +2649,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2527
2649
|
};
|
|
2528
2650
|
Object.defineProperty(self, 'argv', {
|
|
2529
2651
|
get: () => self._parseArgs(processArgs),
|
|
2530
|
-
enumerable: true
|
|
2652
|
+
enumerable: true,
|
|
2531
2653
|
});
|
|
2532
2654
|
self._parseArgs = function parseArgs(args, shortCircuit, _calledFromCommand, commandIndex) {
|
|
2533
2655
|
let skipValidation = !!_calledFromCommand;
|
|
@@ -2536,10 +2658,10 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2536
2658
|
options.configuration = self.getParserConfiguration();
|
|
2537
2659
|
const populateDoubleDash = !!options.configuration['populate--'];
|
|
2538
2660
|
const config = Object.assign({}, options.configuration, {
|
|
2539
|
-
'populate--': true
|
|
2661
|
+
'populate--': true,
|
|
2540
2662
|
});
|
|
2541
2663
|
const parsed = shim$1.Parser.detailed(args, Object.assign({}, options, {
|
|
2542
|
-
configuration: config
|
|
2664
|
+
configuration: Object.assign({ 'parse-positional-numbers': false }, config),
|
|
2543
2665
|
}));
|
|
2544
2666
|
let argv = parsed.argv;
|
|
2545
2667
|
if (parseContext)
|
|
@@ -2550,7 +2672,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2550
2672
|
try {
|
|
2551
2673
|
guessLocale();
|
|
2552
2674
|
if (shortCircuit) {
|
|
2553
|
-
return (populateDoubleDash
|
|
2675
|
+
return self._postProcess(argv, populateDoubleDash, _calledFromCommand);
|
|
2554
2676
|
}
|
|
2555
2677
|
if (helpOpt) {
|
|
2556
2678
|
const helpCmds = [helpOpt]
|
|
@@ -2564,15 +2686,16 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2564
2686
|
const handlerKeys = command$1.getCommands();
|
|
2565
2687
|
const requestCompletions = completion$1.completionKey in argv;
|
|
2566
2688
|
const skipRecommendation = argv[helpOpt] || requestCompletions;
|
|
2567
|
-
const skipDefaultCommand = skipRecommendation &&
|
|
2689
|
+
const skipDefaultCommand = skipRecommendation &&
|
|
2690
|
+
(handlerKeys.length > 1 || handlerKeys[0] !== '$0');
|
|
2568
2691
|
if (argv._.length) {
|
|
2569
2692
|
if (handlerKeys.length) {
|
|
2570
2693
|
let firstUnknownCommand;
|
|
2571
|
-
for (let i =
|
|
2694
|
+
for (let i = commandIndex || 0, cmd; argv._[i] !== undefined; i++) {
|
|
2572
2695
|
cmd = String(argv._[i]);
|
|
2573
2696
|
if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) {
|
|
2574
2697
|
const innerArgv = command$1.runCommand(cmd, self, parsed, i + 1);
|
|
2575
|
-
return
|
|
2698
|
+
return self._postProcess(innerArgv, populateDoubleDash);
|
|
2576
2699
|
}
|
|
2577
2700
|
else if (!firstUnknownCommand && cmd !== completionCommand) {
|
|
2578
2701
|
firstUnknownCommand = cmd;
|
|
@@ -2581,13 +2704,15 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2581
2704
|
}
|
|
2582
2705
|
if (command$1.hasDefaultCommand() && !skipDefaultCommand) {
|
|
2583
2706
|
const innerArgv = command$1.runCommand(null, self, parsed);
|
|
2584
|
-
return
|
|
2707
|
+
return self._postProcess(innerArgv, populateDoubleDash);
|
|
2585
2708
|
}
|
|
2586
2709
|
if (recommendCommands && firstUnknownCommand && !skipRecommendation) {
|
|
2587
2710
|
validation$1.recommendCommands(firstUnknownCommand, handlerKeys);
|
|
2588
2711
|
}
|
|
2589
2712
|
}
|
|
2590
|
-
if (completionCommand &&
|
|
2713
|
+
if (completionCommand &&
|
|
2714
|
+
~argv._.indexOf(completionCommand) &&
|
|
2715
|
+
!requestCompletions) {
|
|
2591
2716
|
if (exitProcess)
|
|
2592
2717
|
setBlocking(true);
|
|
2593
2718
|
self.showCompletionScript();
|
|
@@ -2596,24 +2721,23 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2596
2721
|
}
|
|
2597
2722
|
else if (command$1.hasDefaultCommand() && !skipDefaultCommand) {
|
|
2598
2723
|
const innerArgv = command$1.runCommand(null, self, parsed);
|
|
2599
|
-
return
|
|
2724
|
+
return self._postProcess(innerArgv, populateDoubleDash);
|
|
2600
2725
|
}
|
|
2601
2726
|
if (requestCompletions) {
|
|
2602
2727
|
if (exitProcess)
|
|
2603
2728
|
setBlocking(true);
|
|
2604
2729
|
args = [].concat(args);
|
|
2605
2730
|
const completionArgs = args.slice(args.indexOf(`--${completion$1.completionKey}`) + 1);
|
|
2606
|
-
completion$1.getCompletion(completionArgs,
|
|
2607
|
-
|
|
2608
|
-
(completions || []).forEach((completion) => {
|
|
2731
|
+
completion$1.getCompletion(completionArgs, completions => {
|
|
2732
|
+
(completions || []).forEach(completion => {
|
|
2609
2733
|
_logger.log(completion);
|
|
2610
2734
|
});
|
|
2611
2735
|
self.exit(0);
|
|
2612
2736
|
});
|
|
2613
|
-
return (populateDoubleDash
|
|
2737
|
+
return self._postProcess(argv, !populateDoubleDash, _calledFromCommand);
|
|
2614
2738
|
}
|
|
2615
2739
|
if (!hasOutput) {
|
|
2616
|
-
Object.keys(argv).forEach(
|
|
2740
|
+
Object.keys(argv).forEach(key => {
|
|
2617
2741
|
if (key === helpOpt && argv[key]) {
|
|
2618
2742
|
if (exitProcess)
|
|
2619
2743
|
setBlocking(true);
|
|
@@ -2647,10 +2771,25 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2647
2771
|
else
|
|
2648
2772
|
throw err;
|
|
2649
2773
|
}
|
|
2650
|
-
return (populateDoubleDash
|
|
2774
|
+
return self._postProcess(argv, populateDoubleDash, _calledFromCommand);
|
|
2775
|
+
};
|
|
2776
|
+
self._postProcess = function (argv, populateDoubleDash, calledFromCommand = false) {
|
|
2777
|
+
if (isPromise(argv))
|
|
2778
|
+
return argv;
|
|
2779
|
+
if (calledFromCommand)
|
|
2780
|
+
return argv;
|
|
2781
|
+
if (!populateDoubleDash) {
|
|
2782
|
+
argv = self._copyDoubleDash(argv);
|
|
2783
|
+
}
|
|
2784
|
+
const parsePositionalNumbers = self.getParserConfiguration()['parse-positional-numbers'] ||
|
|
2785
|
+
self.getParserConfiguration()['parse-positional-numbers'] === undefined;
|
|
2786
|
+
if (parsePositionalNumbers) {
|
|
2787
|
+
argv = self._parsePositionalNumbers(argv);
|
|
2788
|
+
}
|
|
2789
|
+
return argv;
|
|
2651
2790
|
};
|
|
2652
2791
|
self._copyDoubleDash = function (argv) {
|
|
2653
|
-
if (
|
|
2792
|
+
if (!argv._ || !argv['--'])
|
|
2654
2793
|
return argv;
|
|
2655
2794
|
argv._.push.apply(argv._, argv['--']);
|
|
2656
2795
|
try {
|
|
@@ -2659,6 +2798,16 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2659
2798
|
catch (_err) { }
|
|
2660
2799
|
return argv;
|
|
2661
2800
|
};
|
|
2801
|
+
self._parsePositionalNumbers = function (argv) {
|
|
2802
|
+
const args = argv['--'] ? argv['--'] : argv._;
|
|
2803
|
+
for (let i = 0, arg; (arg = args[i]) !== undefined; i++) {
|
|
2804
|
+
if (shim$1.Parser.looksLikeNumber(arg) &&
|
|
2805
|
+
Number.isSafeInteger(Math.floor(parseFloat(`${arg}`)))) {
|
|
2806
|
+
args[i] = Number(arg);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
return argv;
|
|
2810
|
+
};
|
|
2662
2811
|
self._runValidation = function runValidation(argv, aliases, positionalMap, parseErrors, isDefaultCommand = false) {
|
|
2663
2812
|
if (parseErrors)
|
|
2664
2813
|
throw new YError(parseErrors.message);
|
|
@@ -2682,7 +2831,11 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2682
2831
|
function guessLocale() {
|
|
2683
2832
|
if (!detectLocale)
|
|
2684
2833
|
return;
|
|
2685
|
-
const locale = shim$1.getEnv('LC_ALL') ||
|
|
2834
|
+
const locale = shim$1.getEnv('LC_ALL') ||
|
|
2835
|
+
shim$1.getEnv('LC_MESSAGES') ||
|
|
2836
|
+
shim$1.getEnv('LANG') ||
|
|
2837
|
+
shim$1.getEnv('LANGUAGE') ||
|
|
2838
|
+
'en_US';
|
|
2686
2839
|
self.locale(locale.replace(/[.:].*/, ''));
|
|
2687
2840
|
}
|
|
2688
2841
|
self.help();
|
|
@@ -2691,7 +2844,7 @@ function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
|
|
|
2691
2844
|
}
|
|
2692
2845
|
const rebase = (base, dir) => shim$1.path.relative(base, dir);
|
|
2693
2846
|
function isYargsInstance(y) {
|
|
2694
|
-
return !!y &&
|
|
2847
|
+
return !!y && typeof y._parseArgs === 'function';
|
|
2695
2848
|
}
|
|
2696
2849
|
|
|
2697
2850
|
var _a, _b;
|
|
@@ -2703,7 +2856,7 @@ const Parser = require('yargs-parser');
|
|
|
2703
2856
|
var cjsPlatformShim = {
|
|
2704
2857
|
assert: {
|
|
2705
2858
|
notStrictEqual: assert.notStrictEqual,
|
|
2706
|
-
strictEqual: assert.strictEqual
|
|
2859
|
+
strictEqual: assert.strictEqual,
|
|
2707
2860
|
},
|
|
2708
2861
|
cliui: require('cliui'),
|
|
2709
2862
|
findUp: require('escalade/sync'),
|
|
@@ -2724,7 +2877,9 @@ var cjsPlatformShim = {
|
|
|
2724
2877
|
process.exit(code);
|
|
2725
2878
|
},
|
|
2726
2879
|
nextTick: process.nextTick,
|
|
2727
|
-
stdColumns: typeof process.stdout.columns !== 'undefined'
|
|
2880
|
+
stdColumns: typeof process.stdout.columns !== 'undefined'
|
|
2881
|
+
? process.stdout.columns
|
|
2882
|
+
: null,
|
|
2728
2883
|
},
|
|
2729
2884
|
readFileSync,
|
|
2730
2885
|
require: require,
|
|
@@ -2732,12 +2887,13 @@ var cjsPlatformShim = {
|
|
|
2732
2887
|
stringWidth: require('string-width'),
|
|
2733
2888
|
y18n: y18n({
|
|
2734
2889
|
directory: resolve(__dirname, '../locales'),
|
|
2735
|
-
updateFiles: false
|
|
2736
|
-
})
|
|
2890
|
+
updateFiles: false,
|
|
2891
|
+
}),
|
|
2737
2892
|
};
|
|
2738
2893
|
|
|
2739
|
-
const minNodeVersion =
|
|
2740
|
-
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
|
2894
|
+
const minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION
|
|
2895
|
+
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
|
2896
|
+
: 10;
|
|
2741
2897
|
if (process && process.version) {
|
|
2742
2898
|
const major = Number(process.version.match(/v([^.]+)/)[1]);
|
|
2743
2899
|
if (major < minNodeVersion) {
|
|
@@ -2758,7 +2914,7 @@ var cjs = {
|
|
|
2758
2914
|
Parser: Parser$1,
|
|
2759
2915
|
processArgv,
|
|
2760
2916
|
rebase,
|
|
2761
|
-
YError
|
|
2917
|
+
YError,
|
|
2762
2918
|
};
|
|
2763
2919
|
|
|
2764
2920
|
module.exports = cjs;
|