Updating NPM dependencies
This commit is contained in:
1303
node_modules/yargs/CHANGELOG.md
generated
vendored
1303
node_modules/yargs/CHANGELOG.md
generated
vendored
File diff suppressed because it is too large
Load Diff
5
node_modules/yargs/LICENSE
generated
vendored
5
node_modules/yargs/LICENSE
generated
vendored
@@ -1,7 +1,6 @@
|
||||
Copyright 2010 James Halliday (mail@substack.net)
|
||||
Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
||||
MIT License
|
||||
|
||||
This project is free software released under the MIT/X11 license:
|
||||
Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
34
node_modules/yargs/README.md
generated
vendored
34
node_modules/yargs/README.md
generated
vendored
@@ -5,17 +5,18 @@
|
||||
<p align="center">
|
||||
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![js-standard-style][standard-image]][standard-url]
|
||||
[![Coverage][coverage-image]][coverage-url]
|
||||
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
|
||||
[![Slack][slack-image]][slack-url]
|
||||
|
||||
## Description :
|
||||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
|
||||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
|
||||
|
||||
It gives you:
|
||||
|
||||
@@ -43,16 +44,16 @@ npm i yargs@next
|
||||
|
||||
### Simple Example
|
||||
|
||||
````javascript
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const argv = require('yargs').argv
|
||||
const {argv} = require('yargs')
|
||||
|
||||
if (argv.ships > 3 && argv.distance < 53.5) {
|
||||
console.log('Plunder more riffiwobbles!')
|
||||
} else {
|
||||
console.log('Retreat from the xupptumblers!')
|
||||
}
|
||||
````
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./plunder.js --ships=4 --distance=22
|
||||
@@ -79,13 +80,28 @@ require('yargs') // eslint-disable-line
|
||||
})
|
||||
.option('verbose', {
|
||||
alias: 'v',
|
||||
default: false
|
||||
type: 'boolean',
|
||||
description: 'Run with verbose logging'
|
||||
})
|
||||
.argv
|
||||
```
|
||||
|
||||
Run the example above with `--help` to see the help for the application.
|
||||
|
||||
## TypeScript
|
||||
|
||||
yargs has type definitions at [@types/yargs][type-definitions].
|
||||
|
||||
```
|
||||
npm i @types/yargs --save-dev
|
||||
```
|
||||
|
||||
See usage examples in [docs](/docs/typescript.md).
|
||||
|
||||
## Webpack
|
||||
|
||||
See usage examples of yargs with webpack in [docs](/docs/webpack.md).
|
||||
|
||||
## Community :
|
||||
|
||||
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
|
||||
@@ -102,6 +118,7 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
|
||||
* [Numbers](/docs/tricks.md#numbers)
|
||||
* [Arrays](/docs/tricks.md#arrays)
|
||||
* [Objects](/docs/tricks.md#objects)
|
||||
* [Quotes](/docs/tricks.md#quotes)
|
||||
* [Advanced Topics](/docs/advanced.md)
|
||||
* [Composing Your App Using Commands](/docs/advanced.md#commands)
|
||||
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
|
||||
@@ -110,8 +127,6 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
|
||||
|
||||
[travis-url]: https://travis-ci.org/yargs/yargs
|
||||
[travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
|
||||
[coveralls-url]: https://coveralls.io/github/yargs/yargs
|
||||
[coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
|
||||
[npm-url]: https://www.npmjs.com/package/yargs
|
||||
[npm-image]: https://img.shields.io/npm/v/yargs.svg
|
||||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
||||
@@ -120,3 +135,6 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
|
||||
[conventional-commits-url]: https://conventionalcommits.org/
|
||||
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
|
||||
[slack-url]: http://devtoolscommunity.herokuapp.com
|
||||
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
|
||||
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
|
||||
[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc
|
||||
|
||||
2
node_modules/yargs/build/lib/apply-extends.d.ts
generated
vendored
Normal file
2
node_modules/yargs/build/lib/apply-extends.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Dictionary } from './common-types';
|
||||
export declare function applyExtends(config: Dictionary, cwd: string, mergeExtends?: boolean): Dictionary;
|
||||
65
node_modules/yargs/build/lib/apply-extends.js
generated
vendored
Normal file
65
node_modules/yargs/build/lib/apply-extends.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.applyExtends = void 0;
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const yerror_1 = require("./yerror");
|
||||
let previouslyVisitedConfigs = [];
|
||||
function checkForCircularExtends(cfgPath) {
|
||||
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
||||
throw new yerror_1.YError(`Circular extended configurations: '${cfgPath}'.`);
|
||||
}
|
||||
}
|
||||
function getPathToDefaultConfig(cwd, pathToExtend) {
|
||||
return path.resolve(cwd, pathToExtend);
|
||||
}
|
||||
function mergeDeep(config1, config2) {
|
||||
const target = {};
|
||||
function isObject(obj) {
|
||||
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
||||
}
|
||||
Object.assign(target, config1);
|
||||
for (const key of Object.keys(config2)) {
|
||||
if (isObject(config2[key]) && isObject(target[key])) {
|
||||
target[key] = mergeDeep(config1[key], config2[key]);
|
||||
}
|
||||
else {
|
||||
target[key] = config2[key];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function applyExtends(config, cwd, mergeExtends = false) {
|
||||
let defaultConfig = {};
|
||||
if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
|
||||
if (typeof config.extends !== 'string')
|
||||
return defaultConfig;
|
||||
const isPath = /\.json|\..*rc$/.test(config.extends);
|
||||
let pathToDefault = null;
|
||||
if (!isPath) {
|
||||
try {
|
||||
pathToDefault = require.resolve(config.extends);
|
||||
}
|
||||
catch (err) {
|
||||
// most likely this simply isn't a module.
|
||||
}
|
||||
}
|
||||
else {
|
||||
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
|
||||
}
|
||||
// maybe the module uses key for some other reason,
|
||||
// err on side of caution.
|
||||
if (!pathToDefault && !isPath)
|
||||
return config;
|
||||
if (!pathToDefault)
|
||||
throw new yerror_1.YError(`Unable to find extended config '${config.extends}' in '${cwd}'.`);
|
||||
checkForCircularExtends(pathToDefault);
|
||||
previouslyVisitedConfigs.push(pathToDefault);
|
||||
defaultConfig = isPath ? JSON.parse(fs.readFileSync(pathToDefault, 'utf8')) : require(config.extends);
|
||||
delete config.extends;
|
||||
defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault), mergeExtends);
|
||||
}
|
||||
previouslyVisitedConfigs = [];
|
||||
return mergeExtends ? mergeDeep(defaultConfig, config) : Object.assign({}, defaultConfig, config);
|
||||
}
|
||||
exports.applyExtends = applyExtends;
|
||||
2
node_modules/yargs/build/lib/argsert.d.ts
generated
vendored
Normal file
2
node_modules/yargs/build/lib/argsert.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function argsert(callerArguments: any[], length?: number): void;
|
||||
export declare function argsert(expected: string, callerArguments: any[], length?: number): void;
|
||||
65
node_modules/yargs/build/lib/argsert.js
generated
vendored
Normal file
65
node_modules/yargs/build/lib/argsert.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.argsert = void 0;
|
||||
const yerror_1 = require("./yerror");
|
||||
const parse_command_1 = require("./parse-command");
|
||||
const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
|
||||
function argsert(arg1, arg2, arg3) {
|
||||
function parseArgs() {
|
||||
return typeof arg1 === 'object'
|
||||
? [{ demanded: [], optional: [] }, arg1, arg2]
|
||||
: [parse_command_1.parseCommand(`cmd ${arg1}`), arg2, arg3];
|
||||
}
|
||||
// TODO: should this eventually raise an exception.
|
||||
try {
|
||||
// preface the argument description with "cmd", so
|
||||
// that we can run it through yargs' command parser.
|
||||
let position = 0;
|
||||
let [parsed, callerArguments, length] = parseArgs();
|
||||
const args = [].slice.call(callerArguments);
|
||||
while (args.length && args[args.length - 1] === undefined)
|
||||
args.pop();
|
||||
length = length || args.length;
|
||||
if (length < parsed.demanded.length) {
|
||||
throw new yerror_1.YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
|
||||
}
|
||||
const totalCommands = parsed.demanded.length + parsed.optional.length;
|
||||
if (length > totalCommands) {
|
||||
throw new yerror_1.YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
|
||||
}
|
||||
parsed.demanded.forEach((demanded) => {
|
||||
const arg = args.shift();
|
||||
const observedType = guessType(arg);
|
||||
const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
|
||||
if (matchingTypes.length === 0)
|
||||
argumentTypeError(observedType, demanded.cmd, position);
|
||||
position += 1;
|
||||
});
|
||||
parsed.optional.forEach((optional) => {
|
||||
if (args.length === 0)
|
||||
return;
|
||||
const arg = args.shift();
|
||||
const observedType = guessType(arg);
|
||||
const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*');
|
||||
if (matchingTypes.length === 0)
|
||||
argumentTypeError(observedType, optional.cmd, position);
|
||||
position += 1;
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
console.warn(err.stack);
|
||||
}
|
||||
}
|
||||
exports.argsert = argsert;
|
||||
function guessType(arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return 'array';
|
||||
}
|
||||
else if (arg === null) {
|
||||
return 'null';
|
||||
}
|
||||
return typeof arg;
|
||||
}
|
||||
function argumentTypeError(observedType, allowedTypes, position) {
|
||||
throw new yerror_1.YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`);
|
||||
}
|
||||
64
node_modules/yargs/build/lib/command.d.ts
generated
vendored
Normal file
64
node_modules/yargs/build/lib/command.d.ts
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/// <reference types="node" />
|
||||
import { Dictionary } from './common-types';
|
||||
import { Middleware } from './middleware';
|
||||
import { Positional } from './parse-command';
|
||||
import { RequireDirectoryOptions } from 'require-directory';
|
||||
import { UsageInstance } from './usage';
|
||||
import { ValidationInstance } from './validation';
|
||||
import { YargsInstance, Options, OptionDefinition, Context, Arguments, DetailedArguments } from './yargs';
|
||||
export declare function command(yargs: YargsInstance, usage: UsageInstance, validation: ValidationInstance, globalMiddleware?: Middleware[]): CommandInstance;
|
||||
/** Instance of the command module. */
|
||||
export interface CommandInstance {
|
||||
addDirectory(dir: string, context: Context, req: NodeRequireFunction, callerFile: string, opts?: RequireDirectoryOptions<any>): void;
|
||||
addHandler(handler: CommandHandlerDefinition): void;
|
||||
addHandler(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): void;
|
||||
cmdToParseOptions(cmdString: string): Positionals;
|
||||
freeze(): void;
|
||||
getCommandHandlers(): Dictionary<CommandHandler>;
|
||||
getCommands(): string[];
|
||||
hasDefaultCommand(): boolean;
|
||||
reset(): CommandInstance;
|
||||
runCommand(command: string | null, yargs: YargsInstance, parsed: DetailedArguments, commandIndex?: number): Arguments | Promise<Arguments>;
|
||||
runDefaultBuilderOn(yargs: YargsInstance): void;
|
||||
unfreeze(): void;
|
||||
}
|
||||
export interface CommandHandlerDefinition extends Partial<Pick<CommandHandler, 'deprecated' | 'description' | 'handler' | 'middlewares'>> {
|
||||
aliases?: string[];
|
||||
builder?: CommandBuilder | CommandBuilderDefinition;
|
||||
command?: string | string[];
|
||||
desc?: CommandHandler['description'];
|
||||
describe?: CommandHandler['description'];
|
||||
}
|
||||
export declare function isCommandHandlerDefinition(cmd: string | string[] | CommandHandlerDefinition): cmd is CommandHandlerDefinition;
|
||||
export interface CommandBuilderDefinition {
|
||||
builder?: CommandBuilder;
|
||||
deprecated?: boolean;
|
||||
handler: CommandHandlerCallback;
|
||||
middlewares?: Middleware[];
|
||||
}
|
||||
export declare function isCommandBuilderDefinition(builder?: CommandBuilder | CommandBuilderDefinition): builder is CommandBuilderDefinition;
|
||||
export interface CommandHandlerCallback {
|
||||
(argv: Arguments): any;
|
||||
}
|
||||
export interface CommandHandler {
|
||||
builder: CommandBuilder;
|
||||
demanded: Positional[];
|
||||
deprecated?: boolean;
|
||||
description?: string | false;
|
||||
handler: CommandHandlerCallback;
|
||||
middlewares: Middleware[];
|
||||
optional: Positional[];
|
||||
original: string;
|
||||
}
|
||||
export declare type CommandBuilder = CommandBuilderCallback | Dictionary<OptionDefinition>;
|
||||
interface CommandBuilderCallback {
|
||||
(y: YargsInstance): YargsInstance | void;
|
||||
}
|
||||
export declare function isCommandBuilderCallback(builder: CommandBuilder): builder is CommandBuilderCallback;
|
||||
interface Positionals extends Pick<Options, 'alias' | 'array' | 'default'> {
|
||||
demand: Dictionary<boolean>;
|
||||
}
|
||||
export interface FinishCommandHandler {
|
||||
(handlerResult: any): any;
|
||||
}
|
||||
export {};
|
||||
416
node_modules/yargs/build/lib/command.js
generated
vendored
Normal file
416
node_modules/yargs/build/lib/command.js
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isCommandBuilderCallback = exports.isCommandBuilderDefinition = exports.isCommandHandlerDefinition = exports.command = void 0;
|
||||
const common_types_1 = require("./common-types");
|
||||
const is_promise_1 = require("./is-promise");
|
||||
const middleware_1 = require("./middleware");
|
||||
const parse_command_1 = require("./parse-command");
|
||||
const path = require("path");
|
||||
const util_1 = require("util");
|
||||
const yargs_1 = require("./yargs");
|
||||
const requireDirectory = require("require-directory");
|
||||
const whichModule = require("which-module");
|
||||
const Parser = require("yargs-parser");
|
||||
const DEFAULT_MARKER = /(^\*)|(^\$0)/;
|
||||
// handles parsing positional arguments,
|
||||
// and populating argv with said positional
|
||||
// arguments.
|
||||
function command(yargs, usage, validation, globalMiddleware = []) {
|
||||
const self = {};
|
||||
let handlers = {};
|
||||
let aliasMap = {};
|
||||
let defaultCommand;
|
||||
self.addHandler = function addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
|
||||
let aliases = [];
|
||||
const middlewares = middleware_1.commandMiddlewareFactory(commandMiddleware);
|
||||
handler = handler || (() => { });
|
||||
if (Array.isArray(cmd)) {
|
||||
aliases = cmd.slice(1);
|
||||
cmd = cmd[0];
|
||||
}
|
||||
else if (isCommandHandlerDefinition(cmd)) {
|
||||
let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd);
|
||||
if (cmd.aliases)
|
||||
command = [].concat(command).concat(cmd.aliases);
|
||||
self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
|
||||
return;
|
||||
}
|
||||
// allow a module to be provided instead of separate builder and handler
|
||||
if (isCommandBuilderDefinition(builder)) {
|
||||
self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
|
||||
return;
|
||||
}
|
||||
// parse positionals out of cmd string
|
||||
const parsedCommand = parse_command_1.parseCommand(cmd);
|
||||
// remove positional args from aliases only
|
||||
aliases = aliases.map(alias => parse_command_1.parseCommand(alias).cmd);
|
||||
// check for default and filter out '*''
|
||||
let isDefault = false;
|
||||
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => {
|
||||
if (DEFAULT_MARKER.test(c)) {
|
||||
isDefault = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// standardize on $0 for default command.
|
||||
if (parsedAliases.length === 0 && isDefault)
|
||||
parsedAliases.push('$0');
|
||||
// shift cmd and aliases after filtering out '*'
|
||||
if (isDefault) {
|
||||
parsedCommand.cmd = parsedAliases[0];
|
||||
aliases = parsedAliases.slice(1);
|
||||
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
|
||||
}
|
||||
// populate aliasMap
|
||||
aliases.forEach((alias) => {
|
||||
aliasMap[alias] = parsedCommand.cmd;
|
||||
});
|
||||
if (description !== false) {
|
||||
usage.command(cmd, description, isDefault, aliases, deprecated);
|
||||
}
|
||||
handlers[parsedCommand.cmd] = {
|
||||
original: cmd,
|
||||
description,
|
||||
handler,
|
||||
builder: builder || {},
|
||||
middlewares,
|
||||
deprecated,
|
||||
demanded: parsedCommand.demanded,
|
||||
optional: parsedCommand.optional
|
||||
};
|
||||
if (isDefault)
|
||||
defaultCommand = handlers[parsedCommand.cmd];
|
||||
};
|
||||
self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) {
|
||||
opts = opts || {};
|
||||
// disable recursion to support nested directories of subcommands
|
||||
if (typeof opts.recurse !== 'boolean')
|
||||
opts.recurse = false;
|
||||
// exclude 'json', 'coffee' from require-directory defaults
|
||||
if (!Array.isArray(opts.extensions))
|
||||
opts.extensions = ['js'];
|
||||
// allow consumer to define their own visitor function
|
||||
const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o;
|
||||
// call addHandler via visitor function
|
||||
opts.visit = function visit(obj, joined, filename) {
|
||||
const visited = parentVisit(obj, joined, filename);
|
||||
// allow consumer to skip modules with their own visitor
|
||||
if (visited) {
|
||||
// check for cyclic reference
|
||||
// each command file path should only be seen once per execution
|
||||
if (~context.files.indexOf(joined))
|
||||
return visited;
|
||||
// keep track of visited files in context.files
|
||||
context.files.push(joined);
|
||||
self.addHandler(visited);
|
||||
}
|
||||
return visited;
|
||||
};
|
||||
requireDirectory({ require: req, filename: callerFile }, dir, opts);
|
||||
};
|
||||
// lookup module object from require()d command and derive name
|
||||
// if module was not require()d and no name given, throw error
|
||||
function moduleName(obj) {
|
||||
const mod = whichModule(obj);
|
||||
if (!mod)
|
||||
throw new Error(`No command name given for module: ${util_1.inspect(obj)}`);
|
||||
return commandFromFilename(mod.filename);
|
||||
}
|
||||
// derive command name from filename
|
||||
function commandFromFilename(filename) {
|
||||
return path.basename(filename, path.extname(filename));
|
||||
}
|
||||
function extractDesc({ describe, description, desc }) {
|
||||
for (const test of [describe, description, desc]) {
|
||||
if (typeof test === 'string' || test === false)
|
||||
return test;
|
||||
common_types_1.assertNotStrictEqual(test, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap));
|
||||
self.getCommandHandlers = () => handlers;
|
||||
self.hasDefaultCommand = () => !!defaultCommand;
|
||||
self.runCommand = function runCommand(command, yargs, parsed, commandIndex) {
|
||||
let aliases = parsed.aliases;
|
||||
const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand;
|
||||
const currentContext = yargs.getContext();
|
||||
let numFiles = currentContext.files.length;
|
||||
const parentCommands = currentContext.commands.slice();
|
||||
// what does yargs look like after the builder is run?
|
||||
let innerArgv = parsed.argv;
|
||||
let positionalMap = {};
|
||||
if (command) {
|
||||
currentContext.commands.push(command);
|
||||
currentContext.fullCommands.push(commandHandler.original);
|
||||
}
|
||||
const builder = commandHandler.builder;
|
||||
if (isCommandBuilderCallback(builder)) {
|
||||
// a function can be provided, which builds
|
||||
// up a yargs chain and possibly returns it.
|
||||
const builderOutput = builder(yargs.reset(parsed.aliases));
|
||||
const innerYargs = yargs_1.isYargsInstance(builderOutput) ? builderOutput : yargs;
|
||||
if (shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
|
||||
}
|
||||
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
|
||||
aliases = innerYargs.parsed.aliases;
|
||||
}
|
||||
else if (isCommandBuilderOptionDefinitions(builder)) {
|
||||
// as a short hand, an object can instead be provided, specifying
|
||||
// the options that a command takes.
|
||||
const innerYargs = yargs.reset(parsed.aliases);
|
||||
if (shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
|
||||
}
|
||||
Object.keys(commandHandler.builder).forEach((key) => {
|
||||
innerYargs.option(key, builder[key]);
|
||||
});
|
||||
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
|
||||
aliases = innerYargs.parsed.aliases;
|
||||
}
|
||||
if (!yargs._hasOutput()) {
|
||||
positionalMap = populatePositionals(commandHandler, innerArgv, currentContext);
|
||||
}
|
||||
const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares);
|
||||
middleware_1.applyMiddleware(innerArgv, yargs, middlewares, true);
|
||||
// we apply validation post-hoc, so that custom
|
||||
// checks get passed populated positional arguments.
|
||||
if (!yargs._hasOutput()) {
|
||||
yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command);
|
||||
}
|
||||
if (commandHandler.handler && !yargs._hasOutput()) {
|
||||
yargs._setHasOutput();
|
||||
// to simplify the parsing of positionals in commands,
|
||||
// we temporarily populate '--' rather than _, with arguments
|
||||
const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
|
||||
if (!populateDoubleDash)
|
||||
yargs._copyDoubleDash(innerArgv);
|
||||
innerArgv = middleware_1.applyMiddleware(innerArgv, yargs, middlewares, false);
|
||||
let handlerResult;
|
||||
if (is_promise_1.isPromise(innerArgv)) {
|
||||
handlerResult = innerArgv.then(argv => commandHandler.handler(argv));
|
||||
}
|
||||
else {
|
||||
handlerResult = commandHandler.handler(innerArgv);
|
||||
}
|
||||
const handlerFinishCommand = yargs.getHandlerFinishCommand();
|
||||
if (is_promise_1.isPromise(handlerResult)) {
|
||||
yargs.getUsageInstance().cacheHelpMessage();
|
||||
handlerResult
|
||||
.then(value => {
|
||||
if (handlerFinishCommand) {
|
||||
handlerFinishCommand(value);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
try {
|
||||
yargs.getUsageInstance().fail(null, error);
|
||||
}
|
||||
catch (err) {
|
||||
// fail's throwing would cause an unhandled rejection.
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
yargs.getUsageInstance().clearCachedHelpMessage();
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (handlerFinishCommand) {
|
||||
handlerFinishCommand(handlerResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command) {
|
||||
currentContext.commands.pop();
|
||||
currentContext.fullCommands.pop();
|
||||
}
|
||||
numFiles = currentContext.files.length - numFiles;
|
||||
if (numFiles > 0)
|
||||
currentContext.files.splice(numFiles * -1, numFiles);
|
||||
return innerArgv;
|
||||
};
|
||||
function shouldUpdateUsage(yargs) {
|
||||
return !yargs.getUsageInstance().getUsageDisabled() &&
|
||||
yargs.getUsageInstance().getUsage().length === 0;
|
||||
}
|
||||
function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
|
||||
const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original;
|
||||
const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c); });
|
||||
pc.push(c);
|
||||
return `$0 ${pc.join(' ')}`;
|
||||
}
|
||||
self.runDefaultBuilderOn = function (yargs) {
|
||||
common_types_1.assertNotStrictEqual(defaultCommand, undefined);
|
||||
if (shouldUpdateUsage(yargs)) {
|
||||
// build the root-level command string from the default string.
|
||||
const commandString = DEFAULT_MARKER.test(defaultCommand.original)
|
||||
? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
|
||||
yargs.getUsageInstance().usage(commandString, defaultCommand.description);
|
||||
}
|
||||
const builder = defaultCommand.builder;
|
||||
if (isCommandBuilderCallback(builder)) {
|
||||
builder(yargs);
|
||||
}
|
||||
else {
|
||||
Object.keys(builder).forEach((key) => {
|
||||
yargs.option(key, builder[key]);
|
||||
});
|
||||
}
|
||||
};
|
||||
// transcribe all positional arguments "command <foo> <bar> [apple]"
|
||||
// onto argv.
|
||||
function populatePositionals(commandHandler, argv, context) {
|
||||
argv._ = argv._.slice(context.commands.length); // nuke the current commands
|
||||
const demanded = commandHandler.demanded.slice(0);
|
||||
const optional = commandHandler.optional.slice(0);
|
||||
const positionalMap = {};
|
||||
validation.positionalCount(demanded.length, argv._.length);
|
||||
while (demanded.length) {
|
||||
const demand = demanded.shift();
|
||||
populatePositional(demand, argv, positionalMap);
|
||||
}
|
||||
while (optional.length) {
|
||||
const maybe = optional.shift();
|
||||
populatePositional(maybe, argv, positionalMap);
|
||||
}
|
||||
argv._ = context.commands.concat(argv._);
|
||||
postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original));
|
||||
return positionalMap;
|
||||
}
|
||||
function populatePositional(positional, argv, positionalMap) {
|
||||
const cmd = positional.cmd[0];
|
||||
if (positional.variadic) {
|
||||
positionalMap[cmd] = argv._.splice(0).map(String);
|
||||
}
|
||||
else {
|
||||
if (argv._.length)
|
||||
positionalMap[cmd] = [String(argv._.shift())];
|
||||
}
|
||||
}
|
||||
// we run yargs-parser against the positional arguments
|
||||
// applying the same parsing logic used for flags.
|
||||
function postProcessPositionals(argv, positionalMap, parseOptions) {
|
||||
// combine the parsing hints we've inferred from the command
|
||||
// string with explicitly configured parsing hints.
|
||||
const options = Object.assign({}, yargs.getOptions());
|
||||
options.default = Object.assign(parseOptions.default, options.default);
|
||||
for (const key of Object.keys(parseOptions.alias)) {
|
||||
options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
|
||||
}
|
||||
options.array = options.array.concat(parseOptions.array);
|
||||
delete options.config; // don't load config when processing positionals.
|
||||
const unparsed = [];
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
positionalMap[key].map((value) => {
|
||||
if (options.configuration['unknown-options-as-args'])
|
||||
options.key[key] = true;
|
||||
unparsed.push(`--${key}`);
|
||||
unparsed.push(value);
|
||||
});
|
||||
});
|
||||
// short-circuit parse.
|
||||
if (!unparsed.length)
|
||||
return;
|
||||
const config = Object.assign({}, options.configuration, {
|
||||
'populate--': true
|
||||
});
|
||||
const parsed = Parser.detailed(unparsed, Object.assign({}, options, {
|
||||
configuration: config
|
||||
}));
|
||||
if (parsed.error) {
|
||||
yargs.getUsageInstance().fail(parsed.error.message, parsed.error);
|
||||
}
|
||||
else {
|
||||
// only copy over positional keys (don't overwrite
|
||||
// flag arguments that were already parsed).
|
||||
const positionalKeys = Object.keys(positionalMap);
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
positionalKeys.push(...parsed.aliases[key]);
|
||||
});
|
||||
Object.keys(parsed.argv).forEach((key) => {
|
||||
if (positionalKeys.indexOf(key) !== -1) {
|
||||
// any new aliases need to be placed in positionalMap, which
|
||||
// is used for validation.
|
||||
if (!positionalMap[key])
|
||||
positionalMap[key] = parsed.argv[key];
|
||||
argv[key] = parsed.argv[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
self.cmdToParseOptions = function (cmdString) {
|
||||
const parseOptions = {
|
||||
array: [],
|
||||
default: {},
|
||||
alias: {},
|
||||
demand: {}
|
||||
};
|
||||
const parsed = parse_command_1.parseCommand(cmdString);
|
||||
parsed.demanded.forEach((d) => {
|
||||
const [cmd, ...aliases] = d.cmd;
|
||||
if (d.variadic) {
|
||||
parseOptions.array.push(cmd);
|
||||
parseOptions.default[cmd] = [];
|
||||
}
|
||||
parseOptions.alias[cmd] = aliases;
|
||||
parseOptions.demand[cmd] = true;
|
||||
});
|
||||
parsed.optional.forEach((o) => {
|
||||
const [cmd, ...aliases] = o.cmd;
|
||||
if (o.variadic) {
|
||||
parseOptions.array.push(cmd);
|
||||
parseOptions.default[cmd] = [];
|
||||
}
|
||||
parseOptions.alias[cmd] = aliases;
|
||||
});
|
||||
return parseOptions;
|
||||
};
|
||||
self.reset = () => {
|
||||
handlers = {};
|
||||
aliasMap = {};
|
||||
defaultCommand = undefined;
|
||||
return self;
|
||||
};
|
||||
// used by yargs.parse() to freeze
|
||||
// the state of commands such that
|
||||
// we can apply .parse() multiple times
|
||||
// with the same yargs instance.
|
||||
const frozens = [];
|
||||
self.freeze = () => {
|
||||
frozens.push({
|
||||
handlers,
|
||||
aliasMap,
|
||||
defaultCommand
|
||||
});
|
||||
};
|
||||
self.unfreeze = () => {
|
||||
const frozen = frozens.pop();
|
||||
common_types_1.assertNotStrictEqual(frozen, undefined);
|
||||
({
|
||||
handlers,
|
||||
aliasMap,
|
||||
defaultCommand
|
||||
} = frozen);
|
||||
};
|
||||
return self;
|
||||
}
|
||||
exports.command = command;
|
||||
function isCommandHandlerDefinition(cmd) {
|
||||
return typeof cmd === 'object';
|
||||
}
|
||||
exports.isCommandHandlerDefinition = isCommandHandlerDefinition;
|
||||
function isCommandBuilderDefinition(builder) {
|
||||
return typeof builder === 'object' &&
|
||||
!!builder.builder &&
|
||||
typeof builder.handler === 'function';
|
||||
}
|
||||
exports.isCommandBuilderDefinition = isCommandBuilderDefinition;
|
||||
function isCommandBuilderCallback(builder) {
|
||||
return typeof builder === 'function';
|
||||
}
|
||||
exports.isCommandBuilderCallback = isCommandBuilderCallback;
|
||||
function isCommandBuilderOptionDefinitions(builder) {
|
||||
return typeof builder === 'object';
|
||||
}
|
||||
36
node_modules/yargs/build/lib/common-types.d.ts
generated
vendored
Normal file
36
node_modules/yargs/build/lib/common-types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* An object whose all properties have the same type.
|
||||
*/
|
||||
export declare type Dictionary<T = any> = {
|
||||
[key: string]: T;
|
||||
};
|
||||
/**
|
||||
* Returns the keys of T that match Dictionary<U> and are not arrays.
|
||||
*/
|
||||
export declare type DictionaryKeyof<T, U = any> = Exclude<KeyOf<T, Dictionary<U>>, KeyOf<T, any[]>>;
|
||||
/**
|
||||
* Returns the keys of T that match U.
|
||||
*/
|
||||
export declare type KeyOf<T, U> = Exclude<{
|
||||
[K in keyof T]: T[K] extends U ? K : never;
|
||||
}[keyof T], undefined>;
|
||||
/**
|
||||
* An array whose first element is not undefined.
|
||||
*/
|
||||
export declare type NotEmptyArray<T = any> = [T, ...T[]];
|
||||
/**
|
||||
* Returns the type of a Dictionary or array values.
|
||||
*/
|
||||
export declare type ValueOf<T> = T extends (infer U)[] ? U : T[keyof T];
|
||||
/**
|
||||
* Typing wrapper around assert.notStrictEqual()
|
||||
*/
|
||||
export declare function assertNotStrictEqual<N, T>(actual: T | N, expected: N, message?: string | Error): asserts actual is Exclude<T, N>;
|
||||
/**
|
||||
* Asserts actual is a single key, not a key array or a key map.
|
||||
*/
|
||||
export declare function assertSingleKey(actual: string | string[] | Dictionary): asserts actual is string;
|
||||
/**
|
||||
* Typing wrapper around Object.keys()
|
||||
*/
|
||||
export declare function objectKeys<T>(object: T): (keyof T)[];
|
||||
25
node_modules/yargs/build/lib/common-types.js
generated
vendored
Normal file
25
node_modules/yargs/build/lib/common-types.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.objectKeys = exports.assertSingleKey = exports.assertNotStrictEqual = void 0;
|
||||
const assert_1 = require("assert");
|
||||
/**
|
||||
* Typing wrapper around assert.notStrictEqual()
|
||||
*/
|
||||
function assertNotStrictEqual(actual, expected, message) {
|
||||
assert_1.notStrictEqual(actual, expected, message);
|
||||
}
|
||||
exports.assertNotStrictEqual = assertNotStrictEqual;
|
||||
/**
|
||||
* Asserts actual is a single key, not a key array or a key map.
|
||||
*/
|
||||
function assertSingleKey(actual) {
|
||||
assert_1.strictEqual(typeof actual, 'string');
|
||||
}
|
||||
exports.assertSingleKey = assertSingleKey;
|
||||
/**
|
||||
* Typing wrapper around Object.keys()
|
||||
*/
|
||||
function objectKeys(object) {
|
||||
return Object.keys(object);
|
||||
}
|
||||
exports.objectKeys = objectKeys;
|
||||
2
node_modules/yargs/build/lib/completion-templates.d.ts
generated
vendored
Normal file
2
node_modules/yargs/build/lib/completion-templates.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const completionShTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word=\"${COMP_WORDS[COMP_CWORD]}\"\n args=(\"${COMP_WORDS[@]}\")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions \"${args[@]}\")\n\n COMPREPLY=( $(compgen -W \"${type_list}\" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o default -F _yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n";
|
||||
export declare const completionZshTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$'\n' reply=($(COMP_CWORD=\"$((CURRENT-1))\" COMP_LINE=\"$BUFFER\" COMP_POINT=\"$CURSOR\" {{app_path}} --get-yargs-completions \"${words[@]}\"))\n IFS=$si\n _describe 'values' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n";
|
||||
@@ -1,5 +1,7 @@
|
||||
exports.completionShTemplate =
|
||||
`###-begin-{{app_name}}-completions-###
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.completionZshTemplate = exports.completionShTemplate = void 0;
|
||||
exports.completionShTemplate = `###-begin-{{app_name}}-completions-###
|
||||
#
|
||||
# yargs command completion script
|
||||
#
|
||||
@@ -27,8 +29,7 @@ _yargs_completions()
|
||||
}
|
||||
complete -o default -F _yargs_completions {{app_name}}
|
||||
###-end-{{app_name}}-completions-###
|
||||
`
|
||||
|
||||
`;
|
||||
exports.completionZshTemplate = `###-begin-{{app_name}}-completions-###
|
||||
#
|
||||
# yargs command completion script
|
||||
@@ -46,4 +47,4 @@ _{{app_name}}_yargs_completions()
|
||||
}
|
||||
compdef _{{app_name}}_yargs_completions {{app_name}}
|
||||
###-end-{{app_name}}-completions-###
|
||||
`
|
||||
`;
|
||||
21
node_modules/yargs/build/lib/completion.d.ts
generated
vendored
Normal file
21
node_modules/yargs/build/lib/completion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { CommandInstance } from './command';
|
||||
import { UsageInstance } from './usage';
|
||||
import { YargsInstance } from './yargs';
|
||||
import { Arguments, DetailedArguments } from 'yargs-parser';
|
||||
export declare function completion(yargs: YargsInstance, usage: UsageInstance, command: CommandInstance): CompletionInstance;
|
||||
/** Instance of the completion module. */
|
||||
export interface CompletionInstance {
|
||||
completionKey: string;
|
||||
generateCompletionScript($0: string, cmd: string): string;
|
||||
getCompletion(args: string[], done: (completions: string[]) => any): any;
|
||||
registerFunction(fn: CompletionFunction): void;
|
||||
setParsed(parsed: DetailedArguments): void;
|
||||
}
|
||||
export declare type CompletionFunction = SyncCompletionFunction | AsyncCompletionFunction;
|
||||
interface SyncCompletionFunction {
|
||||
(current: string, argv: Arguments): string[] | Promise<string[]>;
|
||||
}
|
||||
interface AsyncCompletionFunction {
|
||||
(current: string, argv: Arguments, done: (completions: string[]) => any): any;
|
||||
}
|
||||
export {};
|
||||
135
node_modules/yargs/build/lib/completion.js
generated
vendored
Normal file
135
node_modules/yargs/build/lib/completion.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.completion = void 0;
|
||||
const command_1 = require("./command");
|
||||
const templates = require("./completion-templates");
|
||||
const is_promise_1 = require("./is-promise");
|
||||
const parse_command_1 = require("./parse-command");
|
||||
const path = require("path");
|
||||
const common_types_1 = require("./common-types");
|
||||
// add bash completions to your
|
||||
// yargs-powered applications.
|
||||
function completion(yargs, usage, command) {
|
||||
const self = {
|
||||
completionKey: 'get-yargs-completions'
|
||||
};
|
||||
let aliases;
|
||||
self.setParsed = function setParsed(parsed) {
|
||||
aliases = parsed.aliases;
|
||||
};
|
||||
const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) ||
|
||||
(process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1);
|
||||
// get a list of completion commands.
|
||||
// 'args' is the array of strings from the line to be completed
|
||||
self.getCompletion = function getCompletion(args, done) {
|
||||
const completions = [];
|
||||
const current = args.length ? args[args.length - 1] : '';
|
||||
const argv = yargs.parse(args, true);
|
||||
const parentCommands = yargs.getContext().commands;
|
||||
// a custom completion function can be provided
|
||||
// to completion().
|
||||
function runCompletionFunction(argv) {
|
||||
common_types_1.assertNotStrictEqual(completionFunction, null);
|
||||
if (isSyncCompletionFunction(completionFunction)) {
|
||||
const result = completionFunction(current, argv);
|
||||
// promise based completion function.
|
||||
if (is_promise_1.isPromise(result)) {
|
||||
return result.then((list) => {
|
||||
process.nextTick(() => { done(list); });
|
||||
}).catch((err) => {
|
||||
process.nextTick(() => { throw err; });
|
||||
});
|
||||
}
|
||||
// synchronous completion function.
|
||||
return done(result);
|
||||
}
|
||||
else {
|
||||
// asynchronous completion function
|
||||
return completionFunction(current, argv, (completions) => {
|
||||
done(completions);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (completionFunction) {
|
||||
return is_promise_1.isPromise(argv) ? argv.then(runCompletionFunction) : runCompletionFunction(argv);
|
||||
}
|
||||
const handlers = command.getCommandHandlers();
|
||||
for (let i = 0, ii = args.length; i < ii; ++i) {
|
||||
if (handlers[args[i]] && handlers[args[i]].builder) {
|
||||
const builder = handlers[args[i]].builder;
|
||||
if (command_1.isCommandBuilderCallback(builder)) {
|
||||
const y = yargs.reset();
|
||||
builder(y);
|
||||
return y.argv;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) {
|
||||
usage.getCommands().forEach((usageCommand) => {
|
||||
const commandName = parse_command_1.parseCommand(usageCommand[0]).cmd;
|
||||
if (args.indexOf(commandName) === -1) {
|
||||
if (!zshShell) {
|
||||
completions.push(commandName);
|
||||
}
|
||||
else {
|
||||
const desc = usageCommand[1] || '';
|
||||
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (current.match(/^-/) || (current === '' && completions.length === 0)) {
|
||||
const descs = usage.getDescriptions();
|
||||
const options = yargs.getOptions();
|
||||
Object.keys(options.key).forEach((key) => {
|
||||
const negable = !!options.configuration['boolean-negation'] && options.boolean.includes(key);
|
||||
// If the key and its aliases aren't in 'args', add the key to 'completions'
|
||||
let keyAndAliases = [key].concat(aliases[key] || []);
|
||||
if (negable)
|
||||
keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`));
|
||||
function completeOptionKey(key) {
|
||||
const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1);
|
||||
if (notInArgs) {
|
||||
const startsByTwoDashes = (s) => /^--/.test(s);
|
||||
const isShortOption = (s) => /^[^0-9]$/.test(s);
|
||||
const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--';
|
||||
if (!zshShell) {
|
||||
completions.push(dashes + key);
|
||||
}
|
||||
else {
|
||||
const desc = descs[key] || '';
|
||||
completions.push(dashes + `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
completeOptionKey(key);
|
||||
if (negable && !!options.default[key])
|
||||
completeOptionKey(`no-${key}`);
|
||||
});
|
||||
}
|
||||
done(completions);
|
||||
};
|
||||
// generate the completion script to add to your .bashrc.
|
||||
self.generateCompletionScript = function generateCompletionScript($0, cmd) {
|
||||
let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate;
|
||||
const name = path.basename($0);
|
||||
// add ./to applications not yet installed as bin.
|
||||
if ($0.match(/\.js$/))
|
||||
$0 = `./${$0}`;
|
||||
script = script.replace(/{{app_name}}/g, name);
|
||||
script = script.replace(/{{completion_command}}/g, cmd);
|
||||
return script.replace(/{{app_path}}/g, $0);
|
||||
};
|
||||
// register a function to perform your own custom
|
||||
// completions., this function can be either
|
||||
// synchrnous or asynchronous.
|
||||
let completionFunction = null;
|
||||
self.registerFunction = (fn) => {
|
||||
completionFunction = fn;
|
||||
};
|
||||
return self;
|
||||
}
|
||||
exports.completion = completion;
|
||||
function isSyncCompletionFunction(completionFunction) {
|
||||
return completionFunction.length < 3;
|
||||
}
|
||||
1
node_modules/yargs/build/lib/is-promise.d.ts
generated
vendored
Normal file
1
node_modules/yargs/build/lib/is-promise.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function isPromise<T>(maybePromise: T | Promise<T>): maybePromise is Promise<T>;
|
||||
9
node_modules/yargs/build/lib/is-promise.js
generated
vendored
Normal file
9
node_modules/yargs/build/lib/is-promise.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isPromise = void 0;
|
||||
function isPromise(maybePromise) {
|
||||
return !!maybePromise &&
|
||||
!!maybePromise.then &&
|
||||
(typeof maybePromise.then === 'function');
|
||||
}
|
||||
exports.isPromise = isPromise;
|
||||
1
node_modules/yargs/build/lib/levenshtein.d.ts
generated
vendored
Normal file
1
node_modules/yargs/build/lib/levenshtein.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function levenshtein(a: string, b: string): number;
|
||||
66
node_modules/yargs/lib/levenshtein.js → node_modules/yargs/build/lib/levenshtein.js
generated
vendored
66
node_modules/yargs/lib/levenshtein.js → node_modules/yargs/build/lib/levenshtein.js
generated
vendored
@@ -1,3 +1,4 @@
|
||||
"use strict";
|
||||
/*
|
||||
Copyright (c) 2011 Andrei Mackenzie
|
||||
|
||||
@@ -18,41 +19,40 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.levenshtein = void 0;
|
||||
// levenshtein distance algorithm, pulled from Andrei Mackenzie's MIT licensed.
|
||||
// gist, which can be found here: https://gist.github.com/andrei-m/982927
|
||||
'use strict'
|
||||
// Compute the edit distance between the two given strings
|
||||
module.exports = function levenshtein (a, b) {
|
||||
if (a.length === 0) return b.length
|
||||
if (b.length === 0) return a.length
|
||||
|
||||
const matrix = []
|
||||
|
||||
// increment along the first column of each row
|
||||
let i
|
||||
for (i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i]
|
||||
}
|
||||
|
||||
// increment each column in the first row
|
||||
let j
|
||||
for (j = 0; j <= a.length; j++) {
|
||||
matrix[0][j] = j
|
||||
}
|
||||
|
||||
// Fill in the rest of the matrix
|
||||
for (i = 1; i <= b.length; i++) {
|
||||
for (j = 1; j <= a.length; j++) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1]
|
||||
} else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
||||
Math.min(matrix[i][j - 1] + 1, // insertion
|
||||
matrix[i - 1][j] + 1)) // deletion
|
||||
}
|
||||
function levenshtein(a, b) {
|
||||
if (a.length === 0)
|
||||
return b.length;
|
||||
if (b.length === 0)
|
||||
return a.length;
|
||||
const matrix = [];
|
||||
// increment along the first column of each row
|
||||
let i;
|
||||
for (i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i];
|
||||
}
|
||||
}
|
||||
|
||||
return matrix[b.length][a.length]
|
||||
// increment each column in the first row
|
||||
let j;
|
||||
for (j = 0; j <= a.length; j++) {
|
||||
matrix[0][j] = j;
|
||||
}
|
||||
// Fill in the rest of the matrix
|
||||
for (i = 1; i <= b.length; i++) {
|
||||
for (j = 1; j <= a.length; j++) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
}
|
||||
else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
||||
Math.min(matrix[i][j - 1] + 1, // insertion
|
||||
matrix[i - 1][j] + 1)); // deletion
|
||||
}
|
||||
}
|
||||
}
|
||||
return matrix[b.length][a.length];
|
||||
}
|
||||
exports.levenshtein = levenshtein;
|
||||
10
node_modules/yargs/build/lib/middleware.d.ts
generated
vendored
Normal file
10
node_modules/yargs/build/lib/middleware.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { YargsInstance, Arguments } from './yargs';
|
||||
export declare function globalMiddlewareFactory<T>(globalMiddleware: Middleware[], context: T): (callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean) => T;
|
||||
export declare function commandMiddlewareFactory(commandMiddleware?: MiddlewareCallback[]): Middleware[];
|
||||
export declare function applyMiddleware(argv: Arguments | Promise<Arguments>, yargs: YargsInstance, middlewares: Middleware[], beforeValidation: boolean): Arguments | Promise<Arguments>;
|
||||
export interface MiddlewareCallback {
|
||||
(argv: Arguments, yargs: YargsInstance): Partial<Arguments> | Promise<Partial<Arguments>>;
|
||||
}
|
||||
export interface Middleware extends MiddlewareCallback {
|
||||
applyBeforeValidation: boolean;
|
||||
}
|
||||
57
node_modules/yargs/build/lib/middleware.js
generated
vendored
Normal file
57
node_modules/yargs/build/lib/middleware.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.applyMiddleware = exports.commandMiddlewareFactory = exports.globalMiddlewareFactory = void 0;
|
||||
const argsert_1 = require("./argsert");
|
||||
const is_promise_1 = require("./is-promise");
|
||||
function globalMiddlewareFactory(globalMiddleware, context) {
|
||||
return function (callback, applyBeforeValidation = false) {
|
||||
argsert_1.argsert('<array|function> [boolean]', [callback, applyBeforeValidation], arguments.length);
|
||||
if (Array.isArray(callback)) {
|
||||
for (let i = 0; i < callback.length; i++) {
|
||||
if (typeof callback[i] !== 'function') {
|
||||
throw Error('middleware must be a function');
|
||||
}
|
||||
callback[i].applyBeforeValidation = applyBeforeValidation;
|
||||
}
|
||||
Array.prototype.push.apply(globalMiddleware, callback);
|
||||
}
|
||||
else if (typeof callback === 'function') {
|
||||
callback.applyBeforeValidation = applyBeforeValidation;
|
||||
globalMiddleware.push(callback);
|
||||
}
|
||||
return context;
|
||||
};
|
||||
}
|
||||
exports.globalMiddlewareFactory = globalMiddlewareFactory;
|
||||
function commandMiddlewareFactory(commandMiddleware) {
|
||||
if (!commandMiddleware)
|
||||
return [];
|
||||
return commandMiddleware.map(middleware => {
|
||||
middleware.applyBeforeValidation = false;
|
||||
return middleware;
|
||||
});
|
||||
}
|
||||
exports.commandMiddlewareFactory = commandMiddlewareFactory;
|
||||
function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
|
||||
const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true');
|
||||
return middlewares
|
||||
.reduce((acc, middleware) => {
|
||||
if (middleware.applyBeforeValidation !== beforeValidation) {
|
||||
return acc;
|
||||
}
|
||||
if (is_promise_1.isPromise(acc)) {
|
||||
return acc
|
||||
.then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)]))
|
||||
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
|
||||
}
|
||||
else {
|
||||
const result = middleware(acc, yargs);
|
||||
if (beforeValidation && is_promise_1.isPromise(result))
|
||||
throw beforeValidationError;
|
||||
return is_promise_1.isPromise(result)
|
||||
? result.then(middlewareObj => Object.assign(acc, middlewareObj))
|
||||
: Object.assign(acc, result);
|
||||
}
|
||||
}, argv);
|
||||
}
|
||||
exports.applyMiddleware = applyMiddleware;
|
||||
1
node_modules/yargs/build/lib/obj-filter.d.ts
generated
vendored
Normal file
1
node_modules/yargs/build/lib/obj-filter.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function objFilter<T extends object>(original?: T, filter?: (k: keyof T, v: T[keyof T]) => boolean): T;
|
||||
14
node_modules/yargs/build/lib/obj-filter.js
generated
vendored
Normal file
14
node_modules/yargs/build/lib/obj-filter.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.objFilter = void 0;
|
||||
const common_types_1 = require("./common-types");
|
||||
function objFilter(original = {}, filter = () => true) {
|
||||
const obj = {};
|
||||
common_types_1.objectKeys(original).forEach((key) => {
|
||||
if (filter(key, original[key])) {
|
||||
obj[key] = original[key];
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
exports.objFilter = objFilter;
|
||||
11
node_modules/yargs/build/lib/parse-command.d.ts
generated
vendored
Normal file
11
node_modules/yargs/build/lib/parse-command.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { NotEmptyArray } from './common-types';
|
||||
export declare function parseCommand(cmd: string): ParsedCommand;
|
||||
export interface ParsedCommand {
|
||||
cmd: string;
|
||||
demanded: Positional[];
|
||||
optional: Positional[];
|
||||
}
|
||||
export interface Positional {
|
||||
cmd: NotEmptyArray<string>;
|
||||
variadic: boolean;
|
||||
}
|
||||
36
node_modules/yargs/build/lib/parse-command.js
generated
vendored
Normal file
36
node_modules/yargs/build/lib/parse-command.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseCommand = void 0;
|
||||
function parseCommand(cmd) {
|
||||
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
|
||||
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
|
||||
const bregex = /\.*[\][<>]/g;
|
||||
const firstCommand = splitCommand.shift();
|
||||
if (!firstCommand)
|
||||
throw new Error(`No command found in: ${cmd}`);
|
||||
const parsedCommand = {
|
||||
cmd: firstCommand.replace(bregex, ''),
|
||||
demanded: [],
|
||||
optional: []
|
||||
};
|
||||
splitCommand.forEach((cmd, i) => {
|
||||
let variadic = false;
|
||||
cmd = cmd.replace(/\s/g, '');
|
||||
if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1)
|
||||
variadic = true;
|
||||
if (/^\[/.test(cmd)) {
|
||||
parsedCommand.optional.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic
|
||||
});
|
||||
}
|
||||
else {
|
||||
parsedCommand.demanded.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic
|
||||
});
|
||||
}
|
||||
});
|
||||
return parsedCommand;
|
||||
}
|
||||
exports.parseCommand = parseCommand;
|
||||
2
node_modules/yargs/build/lib/process-argv.d.ts
generated
vendored
Normal file
2
node_modules/yargs/build/lib/process-argv.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function getProcessArgvWithoutBin(): string[];
|
||||
export declare function getProcessArgvBin(): string;
|
||||
31
node_modules/yargs/build/lib/process-argv.js
generated
vendored
Normal file
31
node_modules/yargs/build/lib/process-argv.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getProcessArgvBin = exports.getProcessArgvWithoutBin = void 0;
|
||||
function getProcessArgvBinIndex() {
|
||||
// The binary name is the first command line argument for:
|
||||
// - bundled Electron apps: bin argv1 argv2 ... argvn
|
||||
if (isBundledElectronApp())
|
||||
return 0;
|
||||
// or the second one (default) for:
|
||||
// - standard node apps: node bin.js argv1 argv2 ... argvn
|
||||
// - unbundled Electron apps: electron bin.js argv1 arg2 ... argvn
|
||||
return 1;
|
||||
}
|
||||
function isBundledElectronApp() {
|
||||
// process.defaultApp is either set by electron in an electron unbundled app, or undefined
|
||||
// see https://github.com/electron/electron/blob/master/docs/api/process.md#processdefaultapp-readonly
|
||||
return isElectronApp() && !process.defaultApp;
|
||||
}
|
||||
function isElectronApp() {
|
||||
// process.versions.electron is either set by electron, or undefined
|
||||
// see https://github.com/electron/electron/blob/master/docs/api/process.md#processversionselectron-readonly
|
||||
return !!process.versions.electron;
|
||||
}
|
||||
function getProcessArgvWithoutBin() {
|
||||
return process.argv.slice(getProcessArgvBinIndex() + 1);
|
||||
}
|
||||
exports.getProcessArgvWithoutBin = getProcessArgvWithoutBin;
|
||||
function getProcessArgvBin() {
|
||||
return process.argv[getProcessArgvBinIndex()];
|
||||
}
|
||||
exports.getProcessArgvBin = getProcessArgvBin;
|
||||
49
node_modules/yargs/build/lib/usage.d.ts
generated
vendored
Normal file
49
node_modules/yargs/build/lib/usage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Dictionary } from './common-types';
|
||||
import { YargsInstance } from './yargs';
|
||||
import { YError } from './yerror';
|
||||
import { Y18N } from 'y18n';
|
||||
export declare function usage(yargs: YargsInstance, y18n: Y18N): UsageInstance;
|
||||
/** Instance of the usage module. */
|
||||
export interface UsageInstance {
|
||||
cacheHelpMessage(): void;
|
||||
clearCachedHelpMessage(): void;
|
||||
command(cmd: string, description: string | undefined, isDefault: boolean, aliases: string[], deprecated?: boolean): void;
|
||||
deferY18nLookup(str: string): string;
|
||||
describe(keys: string | string[] | Dictionary<string>, desc?: string): void;
|
||||
epilog(msg: string): void;
|
||||
example(cmd: string, description?: string): void;
|
||||
fail(msg?: string | null, err?: YError | string): void;
|
||||
failFn(f: FailureFunction): void;
|
||||
freeze(): void;
|
||||
functionDescription(fn: {
|
||||
name?: string;
|
||||
}): string;
|
||||
getCommands(): [string, string, boolean, string[], boolean][];
|
||||
getDescriptions(): Dictionary<string | undefined>;
|
||||
getPositionalGroupName(): string;
|
||||
getUsage(): [string, string][];
|
||||
getUsageDisabled(): boolean;
|
||||
help(): string;
|
||||
reset(localLookup: Dictionary<boolean>): UsageInstance;
|
||||
showHelp(level: 'error' | 'log' | ((message: string) => void)): void;
|
||||
showHelpOnFail(enabled?: boolean | string, message?: string): UsageInstance;
|
||||
showVersion(): void;
|
||||
stringifiedValues(values?: any[], separator?: string): string;
|
||||
unfreeze(): void;
|
||||
usage(msg: string | null, description?: string | false): UsageInstance;
|
||||
version(ver: any): void;
|
||||
wrap(cols: number | null | undefined): void;
|
||||
}
|
||||
export interface FailureFunction {
|
||||
(msg: string | undefined | null, err: YError | string | undefined, usage: UsageInstance): void;
|
||||
}
|
||||
export interface FrozenUsageInstance {
|
||||
failMessage: string | undefined | null;
|
||||
failureOutput: boolean;
|
||||
usages: [string, string][];
|
||||
usageDisabled: boolean;
|
||||
epilogs: string[];
|
||||
examples: [string, string][];
|
||||
commands: [string, string, boolean, string[], boolean][];
|
||||
descriptions: Dictionary<string | undefined>;
|
||||
}
|
||||
540
node_modules/yargs/build/lib/usage.js
generated
vendored
Normal file
540
node_modules/yargs/build/lib/usage.js
generated
vendored
Normal file
@@ -0,0 +1,540 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.usage = void 0;
|
||||
// this file handles outputting usage instructions,
|
||||
// failures, etc. keeps logging in one place.
|
||||
const common_types_1 = require("./common-types");
|
||||
const obj_filter_1 = require("./obj-filter");
|
||||
const path = require("path");
|
||||
const yerror_1 = require("./yerror");
|
||||
const decamelize = require("decamelize");
|
||||
const setBlocking = require("set-blocking");
|
||||
const stringWidth = require("string-width");
|
||||
function usage(yargs, y18n) {
|
||||
const __ = y18n.__;
|
||||
const self = {};
|
||||
// methods for ouputting/building failure message.
|
||||
const fails = [];
|
||||
self.failFn = function failFn(f) {
|
||||
fails.push(f);
|
||||
};
|
||||
let failMessage = null;
|
||||
let showHelpOnFail = true;
|
||||
self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
|
||||
function parseFunctionArgs() {
|
||||
return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
|
||||
}
|
||||
const [enabled, message] = parseFunctionArgs();
|
||||
failMessage = message;
|
||||
showHelpOnFail = enabled;
|
||||
return self;
|
||||
};
|
||||
let failureOutput = false;
|
||||
self.fail = function fail(msg, err) {
|
||||
const logger = yargs._getLoggerInstance();
|
||||
if (fails.length) {
|
||||
for (let i = fails.length - 1; i >= 0; --i) {
|
||||
fails[i](msg, err, self);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (yargs.getExitProcess())
|
||||
setBlocking(true);
|
||||
// don't output failure message more than once
|
||||
if (!failureOutput) {
|
||||
failureOutput = true;
|
||||
if (showHelpOnFail) {
|
||||
yargs.showHelp('error');
|
||||
logger.error();
|
||||
}
|
||||
if (msg || err)
|
||||
logger.error(msg || err);
|
||||
if (failMessage) {
|
||||
if (msg || err)
|
||||
logger.error('');
|
||||
logger.error(failMessage);
|
||||
}
|
||||
}
|
||||
err = err || new yerror_1.YError(msg);
|
||||
if (yargs.getExitProcess()) {
|
||||
return yargs.exit(1);
|
||||
}
|
||||
else if (yargs._hasParseCallback()) {
|
||||
return yargs.exit(1, err);
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
// methods for ouputting/building help (usage) message.
|
||||
let usages = [];
|
||||
let usageDisabled = false;
|
||||
self.usage = (msg, description) => {
|
||||
if (msg === null) {
|
||||
usageDisabled = true;
|
||||
usages = [];
|
||||
return self;
|
||||
}
|
||||
usageDisabled = false;
|
||||
usages.push([msg, description || '']);
|
||||
return self;
|
||||
};
|
||||
self.getUsage = () => {
|
||||
return usages;
|
||||
};
|
||||
self.getUsageDisabled = () => {
|
||||
return usageDisabled;
|
||||
};
|
||||
self.getPositionalGroupName = () => {
|
||||
return __('Positionals:');
|
||||
};
|
||||
let examples = [];
|
||||
self.example = (cmd, description) => {
|
||||
examples.push([cmd, description || '']);
|
||||
};
|
||||
let commands = [];
|
||||
self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
|
||||
// the last default wins, so cancel out any previously set default
|
||||
if (isDefault) {
|
||||
commands = commands.map((cmdArray) => {
|
||||
cmdArray[2] = false;
|
||||
return cmdArray;
|
||||
});
|
||||
}
|
||||
commands.push([cmd, description || '', isDefault, aliases, deprecated]);
|
||||
};
|
||||
self.getCommands = () => commands;
|
||||
let descriptions = {};
|
||||
self.describe = function describe(keyOrKeys, desc) {
|
||||
if (Array.isArray(keyOrKeys)) {
|
||||
keyOrKeys.forEach((k) => {
|
||||
self.describe(k, desc);
|
||||
});
|
||||
}
|
||||
else if (typeof keyOrKeys === 'object') {
|
||||
Object.keys(keyOrKeys).forEach((k) => {
|
||||
self.describe(k, keyOrKeys[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
descriptions[keyOrKeys] = desc;
|
||||
}
|
||||
};
|
||||
self.getDescriptions = () => descriptions;
|
||||
let epilogs = [];
|
||||
self.epilog = (msg) => {
|
||||
epilogs.push(msg);
|
||||
};
|
||||
let wrapSet = false;
|
||||
let wrap;
|
||||
self.wrap = (cols) => {
|
||||
wrapSet = true;
|
||||
wrap = cols;
|
||||
};
|
||||
function getWrap() {
|
||||
if (!wrapSet) {
|
||||
wrap = windowWidth();
|
||||
wrapSet = true;
|
||||
}
|
||||
return wrap;
|
||||
}
|
||||
const deferY18nLookupPrefix = '__yargsString__:';
|
||||
self.deferY18nLookup = str => deferY18nLookupPrefix + str;
|
||||
self.help = function help() {
|
||||
if (cachedHelpMessage)
|
||||
return cachedHelpMessage;
|
||||
normalizeAliases();
|
||||
// handle old demanded API
|
||||
const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0);
|
||||
const demandedOptions = yargs.getDemandedOptions();
|
||||
const demandedCommands = yargs.getDemandedCommands();
|
||||
const deprecatedOptions = yargs.getDeprecatedOptions();
|
||||
const groups = yargs.getGroups();
|
||||
const options = yargs.getOptions();
|
||||
let keys = [];
|
||||
keys = keys.concat(Object.keys(descriptions));
|
||||
keys = keys.concat(Object.keys(demandedOptions));
|
||||
keys = keys.concat(Object.keys(demandedCommands));
|
||||
keys = keys.concat(Object.keys(options.default));
|
||||
keys = keys.filter(filterHiddenOptions);
|
||||
keys = Object.keys(keys.reduce((acc, key) => {
|
||||
if (key !== '_')
|
||||
acc[key] = true;
|
||||
return acc;
|
||||
}, {}));
|
||||
const theWrap = getWrap();
|
||||
const ui = require('cliui')({
|
||||
width: theWrap,
|
||||
wrap: !!theWrap
|
||||
});
|
||||
// the usage string.
|
||||
if (!usageDisabled) {
|
||||
if (usages.length) {
|
||||
// user-defined usage.
|
||||
usages.forEach((usage) => {
|
||||
ui.div(`${usage[0].replace(/\$0/g, base$0)}`);
|
||||
if (usage[1]) {
|
||||
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
else if (commands.length) {
|
||||
let u = null;
|
||||
// demonstrate how commands are used.
|
||||
if (demandedCommands._) {
|
||||
u = `${base$0} <${__('command')}>\n`;
|
||||
}
|
||||
else {
|
||||
u = `${base$0} [${__('command')}]\n`;
|
||||
}
|
||||
ui.div(`${u}`);
|
||||
}
|
||||
}
|
||||
// your application's commands, i.e., non-option
|
||||
// arguments populated in '_'.
|
||||
if (commands.length) {
|
||||
ui.div(__('Commands:'));
|
||||
const context = yargs.getContext();
|
||||
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : '';
|
||||
if (yargs.getParserConfiguration()['sort-commands'] === true) {
|
||||
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
||||
}
|
||||
commands.forEach((command) => {
|
||||
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands.
|
||||
ui.span({
|
||||
text: commandString,
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
||||
}, { text: command[1] });
|
||||
const hints = [];
|
||||
if (command[2])
|
||||
hints.push(`[${__('default')}]`);
|
||||
if (command[3] && command[3].length) {
|
||||
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
|
||||
}
|
||||
if (command[4]) {
|
||||
if (typeof command[4] === 'string') {
|
||||
hints.push(`[${__('deprecated: %s', command[4])}]`);
|
||||
}
|
||||
else {
|
||||
hints.push(`[${__('deprecated')}]`);
|
||||
}
|
||||
}
|
||||
if (hints.length) {
|
||||
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' });
|
||||
}
|
||||
else {
|
||||
ui.div();
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
// perform some cleanup on the keys array, making it
|
||||
// only include top-level keys not their aliases.
|
||||
const aliasKeys = (Object.keys(options.alias) || [])
|
||||
.concat(Object.keys(yargs.parsed.newAliases) || []);
|
||||
keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
|
||||
// populate 'Options:' group with any keys that have not
|
||||
// explicitly had a group set.
|
||||
const defaultGroup = __('Options:');
|
||||
if (!groups[defaultGroup])
|
||||
groups[defaultGroup] = [];
|
||||
addUngroupedKeys(keys, options.alias, groups, defaultGroup);
|
||||
// display 'Options:' table along with any custom tables:
|
||||
Object.keys(groups).forEach((groupName) => {
|
||||
if (!groups[groupName].length)
|
||||
return;
|
||||
// if we've grouped the key 'f', but 'f' aliases 'foobar',
|
||||
// normalizedKeys should contain only 'foobar'.
|
||||
const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => {
|
||||
if (~aliasKeys.indexOf(key))
|
||||
return key;
|
||||
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
if (~(options.alias[aliasKey] || []).indexOf(key))
|
||||
return aliasKey;
|
||||
}
|
||||
return key;
|
||||
});
|
||||
if (normalizedKeys.length < 1)
|
||||
return;
|
||||
ui.div(groupName);
|
||||
// actually generate the switches string --foo, -f, --bar.
|
||||
const switches = normalizedKeys.reduce((acc, key) => {
|
||||
acc[key] = [key].concat(options.alias[key] || [])
|
||||
.map(sw => {
|
||||
// for the special positional group don't
|
||||
// add '--' or '-' prefix.
|
||||
if (groupName === self.getPositionalGroupName())
|
||||
return sw;
|
||||
else {
|
||||
return (
|
||||
// matches yargs-parser logic in which single-digits
|
||||
// aliases declared with a boolean type are now valid
|
||||
/^[0-9]$/.test(sw)
|
||||
? ~options.boolean.indexOf(key) ? '-' : '--'
|
||||
: sw.length > 1 ? '--' : '-') + sw;
|
||||
}
|
||||
})
|
||||
.join(', ');
|
||||
return acc;
|
||||
}, {});
|
||||
normalizedKeys.forEach((key) => {
|
||||
const kswitch = switches[key];
|
||||
let desc = descriptions[key] || '';
|
||||
let type = null;
|
||||
if (~desc.lastIndexOf(deferY18nLookupPrefix))
|
||||
desc = __(desc.substring(deferY18nLookupPrefix.length));
|
||||
if (~options.boolean.indexOf(key))
|
||||
type = `[${__('boolean')}]`;
|
||||
if (~options.count.indexOf(key))
|
||||
type = `[${__('count')}]`;
|
||||
if (~options.string.indexOf(key))
|
||||
type = `[${__('string')}]`;
|
||||
if (~options.normalize.indexOf(key))
|
||||
type = `[${__('string')}]`;
|
||||
if (~options.array.indexOf(key))
|
||||
type = `[${__('array')}]`;
|
||||
if (~options.number.indexOf(key))
|
||||
type = `[${__('number')}]`;
|
||||
const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
|
||||
? `[${__('deprecated: %s', deprecated)}]`
|
||||
: `[${__('deprecated')}]`;
|
||||
const extra = [
|
||||
(key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null,
|
||||
type,
|
||||
(key in demandedOptions) ? `[${__('required')}]` : null,
|
||||
options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null,
|
||||
defaultString(options.default[key], options.defaultDescription[key])
|
||||
].filter(Boolean).join(' ');
|
||||
ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc);
|
||||
if (extra)
|
||||
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
|
||||
else
|
||||
ui.div();
|
||||
});
|
||||
ui.div();
|
||||
});
|
||||
// describe some common use-cases for your application.
|
||||
if (examples.length) {
|
||||
ui.div(__('Examples:'));
|
||||
examples.forEach((example) => {
|
||||
example[0] = example[0].replace(/\$0/g, base$0);
|
||||
});
|
||||
examples.forEach((example) => {
|
||||
if (example[1] === '') {
|
||||
ui.div({
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2]
|
||||
});
|
||||
}
|
||||
else {
|
||||
ui.div({
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(examples, theWrap) + 4
|
||||
}, {
|
||||
text: example[1]
|
||||
});
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
// the usage string.
|
||||
if (epilogs.length > 0) {
|
||||
const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n');
|
||||
ui.div(`${e}\n`);
|
||||
}
|
||||
// Remove the trailing white spaces
|
||||
return ui.toString().replace(/\s*$/, '');
|
||||
};
|
||||
// return the maximum width of a string
|
||||
// in the left-hand column of a table.
|
||||
function maxWidth(table, theWrap, modifier) {
|
||||
let width = 0;
|
||||
// table might be of the form [leftColumn],
|
||||
// or {key: leftColumn}
|
||||
if (!Array.isArray(table)) {
|
||||
table = Object.values(table).map(v => [v]);
|
||||
}
|
||||
table.forEach((v) => {
|
||||
width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width);
|
||||
});
|
||||
// if we've enabled 'wrap' we should limit
|
||||
// the max-width of the left-column.
|
||||
if (theWrap)
|
||||
width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
|
||||
return width;
|
||||
}
|
||||
// make sure any options set for aliases,
|
||||
// are copied to the keys being aliased.
|
||||
function normalizeAliases() {
|
||||
// handle old demanded API
|
||||
const demandedOptions = yargs.getDemandedOptions();
|
||||
const options = yargs.getOptions();
|
||||
(Object.keys(options.alias) || []).forEach((key) => {
|
||||
options.alias[key].forEach((alias) => {
|
||||
// copy descriptions.
|
||||
if (descriptions[alias])
|
||||
self.describe(key, descriptions[alias]);
|
||||
// copy demanded.
|
||||
if (alias in demandedOptions)
|
||||
yargs.demandOption(key, demandedOptions[alias]);
|
||||
// type messages.
|
||||
if (~options.boolean.indexOf(alias))
|
||||
yargs.boolean(key);
|
||||
if (~options.count.indexOf(alias))
|
||||
yargs.count(key);
|
||||
if (~options.string.indexOf(alias))
|
||||
yargs.string(key);
|
||||
if (~options.normalize.indexOf(alias))
|
||||
yargs.normalize(key);
|
||||
if (~options.array.indexOf(alias))
|
||||
yargs.array(key);
|
||||
if (~options.number.indexOf(alias))
|
||||
yargs.number(key);
|
||||
});
|
||||
});
|
||||
}
|
||||
// if yargs is executing an async handler, we take a snapshot of the
|
||||
// help message to display on failure:
|
||||
let cachedHelpMessage;
|
||||
self.cacheHelpMessage = function () {
|
||||
cachedHelpMessage = this.help();
|
||||
};
|
||||
// however this snapshot must be cleared afterwards
|
||||
// not to be be used by next calls to parse
|
||||
self.clearCachedHelpMessage = function () {
|
||||
cachedHelpMessage = undefined;
|
||||
};
|
||||
// given a set of keys, place any keys that are
|
||||
// ungrouped under the 'Options:' grouping.
|
||||
function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
|
||||
let groupedKeys = [];
|
||||
let toCheck = null;
|
||||
Object.keys(groups).forEach((group) => {
|
||||
groupedKeys = groupedKeys.concat(groups[group]);
|
||||
});
|
||||
keys.forEach((key) => {
|
||||
toCheck = [key].concat(aliases[key]);
|
||||
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
||||
groups[defaultGroup].push(key);
|
||||
}
|
||||
});
|
||||
return groupedKeys;
|
||||
}
|
||||
function filterHiddenOptions(key) {
|
||||
return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt];
|
||||
}
|
||||
self.showHelp = (level) => {
|
||||
const logger = yargs._getLoggerInstance();
|
||||
if (!level)
|
||||
level = 'error';
|
||||
const emit = typeof level === 'function' ? level : logger[level];
|
||||
emit(self.help());
|
||||
};
|
||||
self.functionDescription = (fn) => {
|
||||
const description = fn.name ? decamelize(fn.name, '-') : __('generated-value');
|
||||
return ['(', description, ')'].join('');
|
||||
};
|
||||
self.stringifiedValues = function stringifiedValues(values, separator) {
|
||||
let string = '';
|
||||
const sep = separator || ', ';
|
||||
const array = [].concat(values);
|
||||
if (!values || !array.length)
|
||||
return string;
|
||||
array.forEach((value) => {
|
||||
if (string.length)
|
||||
string += sep;
|
||||
string += JSON.stringify(value);
|
||||
});
|
||||
return string;
|
||||
};
|
||||
// format the default-value-string displayed in
|
||||
// the right-hand column.
|
||||
function defaultString(value, defaultDescription) {
|
||||
let string = `[${__('default:')} `;
|
||||
if (value === undefined && !defaultDescription)
|
||||
return null;
|
||||
if (defaultDescription) {
|
||||
string += defaultDescription;
|
||||
}
|
||||
else {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
string += `"${value}"`;
|
||||
break;
|
||||
case 'object':
|
||||
string += JSON.stringify(value);
|
||||
break;
|
||||
default:
|
||||
string += value;
|
||||
}
|
||||
}
|
||||
return `${string}]`;
|
||||
}
|
||||
// guess the width of the console window, max-width 80.
|
||||
function windowWidth() {
|
||||
const maxWidth = 80;
|
||||
// CI is not a TTY
|
||||
/* c8 ignore next 2 */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return Math.min(maxWidth, process.stdout.columns);
|
||||
}
|
||||
else {
|
||||
return maxWidth;
|
||||
}
|
||||
}
|
||||
// logic for displaying application version.
|
||||
let version = null;
|
||||
self.version = (ver) => {
|
||||
version = ver;
|
||||
};
|
||||
self.showVersion = () => {
|
||||
const logger = yargs._getLoggerInstance();
|
||||
logger.log(version);
|
||||
};
|
||||
self.reset = function reset(localLookup) {
|
||||
// do not reset wrap here
|
||||
// do not reset fails here
|
||||
failMessage = null;
|
||||
failureOutput = false;
|
||||
usages = [];
|
||||
usageDisabled = false;
|
||||
epilogs = [];
|
||||
examples = [];
|
||||
commands = [];
|
||||
descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]);
|
||||
return self;
|
||||
};
|
||||
const frozens = [];
|
||||
self.freeze = function freeze() {
|
||||
frozens.push({
|
||||
failMessage,
|
||||
failureOutput,
|
||||
usages,
|
||||
usageDisabled,
|
||||
epilogs,
|
||||
examples,
|
||||
commands,
|
||||
descriptions
|
||||
});
|
||||
};
|
||||
self.unfreeze = function unfreeze() {
|
||||
const frozen = frozens.pop();
|
||||
common_types_1.assertNotStrictEqual(frozen, undefined);
|
||||
({
|
||||
failMessage,
|
||||
failureOutput,
|
||||
usages,
|
||||
usageDisabled,
|
||||
epilogs,
|
||||
examples,
|
||||
commands,
|
||||
descriptions
|
||||
} = frozen);
|
||||
};
|
||||
return self;
|
||||
}
|
||||
exports.usage = usage;
|
||||
34
node_modules/yargs/build/lib/validation.d.ts
generated
vendored
Normal file
34
node_modules/yargs/build/lib/validation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Dictionary } from './common-types';
|
||||
import { UsageInstance } from './usage';
|
||||
import { YargsInstance, Arguments } from './yargs';
|
||||
import { DetailedArguments } from 'yargs-parser';
|
||||
import { Y18N } from 'y18n';
|
||||
export declare function validation(yargs: YargsInstance, usage: UsageInstance, y18n: Y18N): ValidationInstance;
|
||||
/** Instance of the validation module. */
|
||||
export interface ValidationInstance {
|
||||
check(f: CustomCheck['func'], global: boolean): void;
|
||||
conflicting(argv: Arguments): void;
|
||||
conflicts(key: string | Dictionary<string | string[]>, value?: string | string[]): void;
|
||||
customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void;
|
||||
freeze(): void;
|
||||
getConflicting(): Dictionary<(string | undefined)[]>;
|
||||
getImplied(): Dictionary<KeyOrPos[]>;
|
||||
implications(argv: Arguments): void;
|
||||
implies(key: string | Dictionary<KeyOrPos | KeyOrPos[]>, value?: KeyOrPos | KeyOrPos[]): void;
|
||||
isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean;
|
||||
limitedChoices(argv: Arguments): void;
|
||||
nonOptionCount(argv: Arguments): void;
|
||||
positionalCount(required: number, observed: number): void;
|
||||
recommendCommands(cmd: string, potentialCommands: string[]): void;
|
||||
requiredArguments(argv: Arguments): void;
|
||||
reset(localLookup: Dictionary): ValidationInstance;
|
||||
unfreeze(): void;
|
||||
unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void;
|
||||
unknownCommands(argv: Arguments): boolean;
|
||||
}
|
||||
interface CustomCheck {
|
||||
func: (argv: Arguments, aliases: DetailedArguments['aliases']) => any;
|
||||
global: boolean;
|
||||
}
|
||||
export declare type KeyOrPos = string | number;
|
||||
export {};
|
||||
330
node_modules/yargs/build/lib/validation.js
generated
vendored
Normal file
330
node_modules/yargs/build/lib/validation.js
generated
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validation = void 0;
|
||||
const argsert_1 = require("./argsert");
|
||||
const common_types_1 = require("./common-types");
|
||||
const levenshtein_1 = require("./levenshtein");
|
||||
const obj_filter_1 = require("./obj-filter");
|
||||
const specialKeys = ['$0', '--', '_'];
|
||||
// validation-type-stuff, missing params,
|
||||
// bad implications, custom checks.
|
||||
function validation(yargs, usage, y18n) {
|
||||
const __ = y18n.__;
|
||||
const __n = y18n.__n;
|
||||
const self = {};
|
||||
// validate appropriate # of non-option
|
||||
// arguments were provided, i.e., '_'.
|
||||
self.nonOptionCount = function nonOptionCount(argv) {
|
||||
const demandedCommands = yargs.getDemandedCommands();
|
||||
// don't count currently executing commands
|
||||
const _s = argv._.length - yargs.getContext().commands.length;
|
||||
if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
||||
if (_s < demandedCommands._.min) {
|
||||
if (demandedCommands._.minMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.minMsg
|
||||
? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString())
|
||||
: null);
|
||||
}
|
||||
else {
|
||||
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s, demandedCommands._.min));
|
||||
}
|
||||
}
|
||||
else if (_s > demandedCommands._.max) {
|
||||
if (demandedCommands._.maxMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.maxMsg
|
||||
? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString())
|
||||
: null);
|
||||
}
|
||||
else {
|
||||
usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s, demandedCommands._.max));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// validate the appropriate # of <required>
|
||||
// positional arguments were provided:
|
||||
self.positionalCount = function positionalCount(required, observed) {
|
||||
if (observed < required) {
|
||||
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed, required));
|
||||
}
|
||||
};
|
||||
// make sure all the required arguments are present.
|
||||
self.requiredArguments = function requiredArguments(argv) {
|
||||
const demandedOptions = yargs.getDemandedOptions();
|
||||
let missing = null;
|
||||
for (const key of Object.keys(demandedOptions)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(argv, key) || typeof argv[key] === 'undefined') {
|
||||
missing = missing || {};
|
||||
missing[key] = demandedOptions[key];
|
||||
}
|
||||
}
|
||||
if (missing) {
|
||||
const customMsgs = [];
|
||||
for (const key of Object.keys(missing)) {
|
||||
const msg = missing[key];
|
||||
if (msg && customMsgs.indexOf(msg) < 0) {
|
||||
customMsgs.push(msg);
|
||||
}
|
||||
}
|
||||
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : '';
|
||||
usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg));
|
||||
}
|
||||
};
|
||||
// check for unknown arguments (strict-mode).
|
||||
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand) {
|
||||
const commandKeys = yargs.getCommandInstance().getCommands();
|
||||
const unknown = [];
|
||||
const currentContext = yargs.getContext();
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
!Object.prototype.hasOwnProperty.call(positionalMap, key) &&
|
||||
!Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) &&
|
||||
!self.isValidAndSomeAliasIsNotNew(key, aliases)) {
|
||||
unknown.push(key);
|
||||
}
|
||||
});
|
||||
if ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand) {
|
||||
argv._.slice(currentContext.commands.length).forEach((key) => {
|
||||
if (commandKeys.indexOf(key) === -1) {
|
||||
unknown.push(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (unknown.length > 0) {
|
||||
usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', ')));
|
||||
}
|
||||
};
|
||||
self.unknownCommands = function unknownCommands(argv) {
|
||||
const commandKeys = yargs.getCommandInstance().getCommands();
|
||||
const unknown = [];
|
||||
const currentContext = yargs.getContext();
|
||||
if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) {
|
||||
argv._.slice(currentContext.commands.length).forEach((key) => {
|
||||
if (commandKeys.indexOf(key) === -1) {
|
||||
unknown.push(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (unknown.length > 0) {
|
||||
usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', ')));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
// check for a key that is not an alias, or for which every alias is new,
|
||||
// implying that it was invented by the parser, e.g., during camelization
|
||||
self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
|
||||
if (!Object.prototype.hasOwnProperty.call(aliases, key)) {
|
||||
return false;
|
||||
}
|
||||
const newAliases = yargs.parsed.newAliases;
|
||||
for (const a of [key, ...aliases[key]]) {
|
||||
if (!Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// validate arguments limited to enumerated choices
|
||||
self.limitedChoices = function limitedChoices(argv) {
|
||||
const options = yargs.getOptions();
|
||||
const invalid = {};
|
||||
if (!Object.keys(options.choices).length)
|
||||
return;
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
Object.prototype.hasOwnProperty.call(options.choices, key)) {
|
||||
[].concat(argv[key]).forEach((value) => {
|
||||
// TODO case-insensitive configurability
|
||||
if (options.choices[key].indexOf(value) === -1 &&
|
||||
value !== undefined) {
|
||||
invalid[key] = (invalid[key] || []).concat(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
const invalidKeys = Object.keys(invalid);
|
||||
if (!invalidKeys.length)
|
||||
return;
|
||||
let msg = __('Invalid values:');
|
||||
invalidKeys.forEach((key) => {
|
||||
msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
|
||||
});
|
||||
usage.fail(msg);
|
||||
};
|
||||
// custom checks, added using the `check` option on yargs.
|
||||
let checks = [];
|
||||
self.check = function check(f, global) {
|
||||
checks.push({
|
||||
func: f,
|
||||
global
|
||||
});
|
||||
};
|
||||
self.customChecks = function customChecks(argv, aliases) {
|
||||
for (let i = 0, f; (f = checks[i]) !== undefined; i++) {
|
||||
const func = f.func;
|
||||
let result = null;
|
||||
try {
|
||||
result = func(argv, aliases);
|
||||
}
|
||||
catch (err) {
|
||||
usage.fail(err.message ? err.message : err, err);
|
||||
continue;
|
||||
}
|
||||
if (!result) {
|
||||
usage.fail(__('Argument check failed: %s', func.toString()));
|
||||
}
|
||||
else if (typeof result === 'string' || result instanceof Error) {
|
||||
usage.fail(result.toString(), result);
|
||||
}
|
||||
}
|
||||
};
|
||||
// check implications, argument foo implies => argument bar.
|
||||
let implied = {};
|
||||
self.implies = function implies(key, value) {
|
||||
argsert_1.argsert('<string|object> [array|number|string]', [key, value], arguments.length);
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.implies(k, key[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
yargs.global(key);
|
||||
if (!implied[key]) {
|
||||
implied[key] = [];
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.implies(key, i));
|
||||
}
|
||||
else {
|
||||
common_types_1.assertNotStrictEqual(value, undefined);
|
||||
implied[key].push(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
self.getImplied = function getImplied() {
|
||||
return implied;
|
||||
};
|
||||
function keyExists(argv, val) {
|
||||
// convert string '1' to number 1
|
||||
const num = Number(val);
|
||||
val = isNaN(num) ? val : num;
|
||||
if (typeof val === 'number') {
|
||||
// check length of argv._
|
||||
val = argv._.length >= val;
|
||||
}
|
||||
else if (val.match(/^--no-.+/)) {
|
||||
// check if key/value doesn't exist
|
||||
val = val.match(/^--no-(.+)/)[1];
|
||||
val = !argv[val];
|
||||
}
|
||||
else {
|
||||
// check if key/value exists
|
||||
val = argv[val];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
self.implications = function implications(argv) {
|
||||
const implyFail = [];
|
||||
Object.keys(implied).forEach((key) => {
|
||||
const origKey = key;
|
||||
(implied[key] || []).forEach((value) => {
|
||||
let key = origKey;
|
||||
const origValue = value;
|
||||
key = keyExists(argv, key);
|
||||
value = keyExists(argv, value);
|
||||
if (key && !value) {
|
||||
implyFail.push(` ${origKey} -> ${origValue}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (implyFail.length) {
|
||||
let msg = `${__('Implications failed:')}\n`;
|
||||
implyFail.forEach((value) => {
|
||||
msg += (value);
|
||||
});
|
||||
usage.fail(msg);
|
||||
}
|
||||
};
|
||||
let conflicting = {};
|
||||
self.conflicts = function conflicts(key, value) {
|
||||
argsert_1.argsert('<string|object> [array|string]', [key, value], arguments.length);
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.conflicts(k, key[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
yargs.global(key);
|
||||
if (!conflicting[key]) {
|
||||
conflicting[key] = [];
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.conflicts(key, i));
|
||||
}
|
||||
else {
|
||||
conflicting[key].push(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
self.getConflicting = () => conflicting;
|
||||
self.conflicting = function conflictingFn(argv) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (conflicting[key]) {
|
||||
conflicting[key].forEach((value) => {
|
||||
// we default keys to 'undefined' that have been configured, we should not
|
||||
// apply conflicting check unless they are a value other than 'undefined'.
|
||||
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
|
||||
const threshold = 3; // if it takes more than three edits, let's move on.
|
||||
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
|
||||
let recommended = null;
|
||||
let bestDistance = Infinity;
|
||||
for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
|
||||
const d = levenshtein_1.levenshtein(cmd, candidate);
|
||||
if (d <= threshold && d < bestDistance) {
|
||||
bestDistance = d;
|
||||
recommended = candidate;
|
||||
}
|
||||
}
|
||||
if (recommended)
|
||||
usage.fail(__('Did you mean %s?', recommended));
|
||||
};
|
||||
self.reset = function reset(localLookup) {
|
||||
implied = obj_filter_1.objFilter(implied, k => !localLookup[k]);
|
||||
conflicting = obj_filter_1.objFilter(conflicting, k => !localLookup[k]);
|
||||
checks = checks.filter(c => c.global);
|
||||
return self;
|
||||
};
|
||||
const frozens = [];
|
||||
self.freeze = function freeze() {
|
||||
frozens.push({
|
||||
implied,
|
||||
checks,
|
||||
conflicting
|
||||
});
|
||||
};
|
||||
self.unfreeze = function unfreeze() {
|
||||
const frozen = frozens.pop();
|
||||
common_types_1.assertNotStrictEqual(frozen, undefined);
|
||||
({
|
||||
implied,
|
||||
checks,
|
||||
conflicting
|
||||
} = frozen);
|
||||
};
|
||||
return self;
|
||||
}
|
||||
exports.validation = validation;
|
||||
274
node_modules/yargs/build/lib/yargs.d.ts
generated
vendored
Normal file
274
node_modules/yargs/build/lib/yargs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
/// <reference types="node" />
|
||||
import { CommandInstance, CommandHandler, CommandBuilderDefinition, CommandBuilder, CommandHandlerCallback, FinishCommandHandler } from './command';
|
||||
import { Dictionary } from './common-types';
|
||||
import { Arguments as ParserArguments, DetailedArguments as ParserDetailedArguments, Configuration as ParserConfiguration, Options as ParserOptions, ConfigCallback, CoerceCallback } from 'yargs-parser';
|
||||
import { YError } from './yerror';
|
||||
import { UsageInstance, FailureFunction } from './usage';
|
||||
import { CompletionFunction } from './completion';
|
||||
import { ValidationInstance, KeyOrPos } from './validation';
|
||||
import { Y18N } from 'y18n';
|
||||
import { MiddlewareCallback, Middleware } from './middleware';
|
||||
import { RequireDirectoryOptions } from 'require-directory';
|
||||
export declare function Yargs(processArgs?: string | string[], cwd?: string, parentRequire?: NodeRequire): YargsInstance;
|
||||
export declare function rebase(base: string, dir: string): string;
|
||||
/** Instance of the yargs module. */
|
||||
export interface YargsInstance {
|
||||
$0: string;
|
||||
argv: Arguments;
|
||||
customScriptName: boolean;
|
||||
parsed: DetailedArguments | false;
|
||||
_copyDoubleDash<T extends Arguments | Promise<Arguments>>(argv: T): T;
|
||||
_getLoggerInstance(): LoggerInstance;
|
||||
_getParseContext(): Object;
|
||||
_hasOutput(): boolean;
|
||||
_hasParseCallback(): boolean;
|
||||
_parseArgs: {
|
||||
(args: null, shortCircuit: null, _calledFromCommand: boolean, commandIndex?: number): Arguments | Promise<Arguments>;
|
||||
(args: string | string[], shortCircuit?: boolean): Arguments | Promise<Arguments>;
|
||||
};
|
||||
_runValidation(argv: Arguments, aliases: Dictionary<string[]>, positionalMap: Dictionary<string[]>, parseErrors: Error | null, isDefaultCommand?: boolean): void;
|
||||
_setHasOutput(): void;
|
||||
addHelpOpt: {
|
||||
(opt?: string | false): YargsInstance;
|
||||
(opt?: string, msg?: string): YargsInstance;
|
||||
};
|
||||
addShowHiddenOpt: {
|
||||
(opt?: string | false): YargsInstance;
|
||||
(opt?: string, msg?: string): YargsInstance;
|
||||
};
|
||||
alias: {
|
||||
(keys: string | string[], aliases: string | string[]): YargsInstance;
|
||||
(keyAliases: Dictionary<string | string[]>): YargsInstance;
|
||||
};
|
||||
array(keys: string | string[]): YargsInstance;
|
||||
boolean(keys: string | string[]): YargsInstance;
|
||||
check(f: (argv: Arguments, aliases: Dictionary<string[]>) => any, _global?: boolean): YargsInstance;
|
||||
choices: {
|
||||
(keys: string | string[], choices: string | string[]): YargsInstance;
|
||||
(keyChoices: Dictionary<string | string[]>): YargsInstance;
|
||||
};
|
||||
coerce: {
|
||||
(keys: string | string[], coerceCallback: CoerceCallback): YargsInstance;
|
||||
(keyCoerceCallbacks: Dictionary<CoerceCallback>): YargsInstance;
|
||||
};
|
||||
command(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): YargsInstance;
|
||||
commandDir(dir: string, opts?: RequireDirectoryOptions<any>): YargsInstance;
|
||||
completion: {
|
||||
(cmd?: string, fn?: CompletionFunction): YargsInstance;
|
||||
(cmd?: string, desc?: string | false, fn?: CompletionFunction): YargsInstance;
|
||||
};
|
||||
config: {
|
||||
(config: Dictionary): YargsInstance;
|
||||
(keys?: string | string[], configCallback?: ConfigCallback): YargsInstance;
|
||||
(keys?: string | string[], msg?: string, configCallback?: ConfigCallback): YargsInstance;
|
||||
};
|
||||
conflicts: {
|
||||
(key: string, conflictsWith: string | string[]): YargsInstance;
|
||||
(keyConflicts: Dictionary<string | string[]>): YargsInstance;
|
||||
};
|
||||
count(keys: string | string[]): YargsInstance;
|
||||
default: {
|
||||
(key: string, value: any, defaultDescription?: string): YargsInstance;
|
||||
(keys: string[], value: Exclude<any, Function>): YargsInstance;
|
||||
(keys: Dictionary<any>): YargsInstance;
|
||||
};
|
||||
defaults: YargsInstance['default'];
|
||||
demand: {
|
||||
(min: number, max?: number | string, msg?: string): YargsInstance;
|
||||
(keys: string | string[], msg?: string | true): YargsInstance;
|
||||
(keys: string | string[], max: string[], msg?: string | true): YargsInstance;
|
||||
(keyMsgs: Dictionary<string | undefined>): YargsInstance;
|
||||
(keyMsgs: Dictionary<string | undefined>, max: string[], msg?: string): YargsInstance;
|
||||
};
|
||||
demandCommand(): YargsInstance;
|
||||
demandCommand(min: number, minMsg?: string): YargsInstance;
|
||||
demandCommand(min: number, max: number, minMsg?: string | null, maxMsg?: string | null): YargsInstance;
|
||||
demandOption: {
|
||||
(keys: string | string[], msg?: string): YargsInstance;
|
||||
(keyMsgs: Dictionary<string | undefined>): YargsInstance;
|
||||
};
|
||||
deprecateOption(option: string, message?: string | boolean): YargsInstance;
|
||||
describe: {
|
||||
(keys: string | string[], description?: string): YargsInstance;
|
||||
(keyDescriptions: Dictionary<string>): YargsInstance;
|
||||
};
|
||||
detectLocale(detect: boolean): YargsInstance;
|
||||
env(prefix?: string | false): YargsInstance;
|
||||
epilog: YargsInstance['epilogue'];
|
||||
epilogue(msg: string): YargsInstance;
|
||||
example(cmd: string | [string, string?][], description?: string): YargsInstance;
|
||||
exit(code: number, err?: YError | string): void;
|
||||
exitProcess(enabled: boolean): YargsInstance;
|
||||
fail(f: FailureFunction): YargsInstance;
|
||||
getCommandInstance(): CommandInstance;
|
||||
getCompletion(args: string[], done: (completions: string[]) => any): void;
|
||||
getContext(): Context;
|
||||
getDemandedCommands(): Options['demandedCommands'];
|
||||
getDemandedOptions(): Options['demandedOptions'];
|
||||
getDeprecatedOptions(): Options['deprecatedOptions'];
|
||||
getDetectLocale(): boolean;
|
||||
getExitProcess(): boolean;
|
||||
getGroups(): Dictionary<string[]>;
|
||||
getHandlerFinishCommand(): FinishCommandHandler | null;
|
||||
getOptions(): Options;
|
||||
getParserConfiguration(): Configuration;
|
||||
getStrict(): boolean;
|
||||
getStrictCommands(): boolean;
|
||||
getUsageInstance(): UsageInstance;
|
||||
getValidationInstance(): ValidationInstance;
|
||||
global(keys: string | string[], global?: boolean): YargsInstance;
|
||||
group(keys: string | string[], groupName: string): YargsInstance;
|
||||
help: YargsInstance['addHelpOpt'];
|
||||
hide(key: string): YargsInstance;
|
||||
implies: {
|
||||
(key: string, implication: KeyOrPos | KeyOrPos[]): YargsInstance;
|
||||
(keyImplications: Dictionary<KeyOrPos | KeyOrPos[]>): YargsInstance;
|
||||
};
|
||||
locale: {
|
||||
(): string;
|
||||
(locale: string): YargsInstance;
|
||||
};
|
||||
middleware(callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean): YargsInstance;
|
||||
nargs: {
|
||||
(keys: string | string[], nargs: number): YargsInstance;
|
||||
(keyNargs: Dictionary<number>): YargsInstance;
|
||||
};
|
||||
normalize(keys: string | string[]): YargsInstance;
|
||||
number(keys: string | string[]): YargsInstance;
|
||||
onFinishCommand(f: FinishCommandHandler): YargsInstance;
|
||||
option: {
|
||||
(key: string, optionDefinition: OptionDefinition): YargsInstance;
|
||||
(keyOptionDefinitions: Dictionary<OptionDefinition>): YargsInstance;
|
||||
};
|
||||
options: YargsInstance['option'];
|
||||
parse: {
|
||||
(): Arguments | Promise<Arguments>;
|
||||
(args: string | string[], context: object, parseCallback?: ParseCallback): Arguments | Promise<Arguments>;
|
||||
(args: string | string[], parseCallback: ParseCallback): Arguments | Promise<Arguments>;
|
||||
(args: string | string[], shortCircuit: boolean): Arguments | Promise<Arguments>;
|
||||
};
|
||||
parserConfiguration(config: Configuration): YargsInstance;
|
||||
pkgConf(key: string, rootPath?: string): YargsInstance;
|
||||
positional(key: string, positionalDefinition: PositionalDefinition): YargsInstance;
|
||||
recommendCommands(recommend: boolean): YargsInstance;
|
||||
require: YargsInstance['demand'];
|
||||
required: YargsInstance['demand'];
|
||||
requiresArg(keys: string | string[] | Dictionary): YargsInstance;
|
||||
reset(aliases?: DetailedArguments['aliases']): YargsInstance;
|
||||
resetOptions(aliases?: DetailedArguments['aliases']): YargsInstance;
|
||||
scriptName(scriptName: string): YargsInstance;
|
||||
showCompletionScript($0?: string, cmd?: string): YargsInstance;
|
||||
showHelp(level: 'error' | 'log' | ((message: string) => void)): YargsInstance;
|
||||
showHelpOnFail: {
|
||||
(message?: string): YargsInstance;
|
||||
(enabled: boolean, message: string): YargsInstance;
|
||||
};
|
||||
showHidden: YargsInstance['addShowHiddenOpt'];
|
||||
skipValidation(keys: string | string[]): YargsInstance;
|
||||
strict(enable?: boolean): YargsInstance;
|
||||
strictCommands(enable?: boolean): YargsInstance;
|
||||
string(key: string | string[]): YargsInstance;
|
||||
terminalWidth(): number | null;
|
||||
updateStrings(obj: Dictionary<string>): YargsInstance;
|
||||
updateLocale: YargsInstance['updateStrings'];
|
||||
usage: {
|
||||
(msg: string | null): YargsInstance;
|
||||
(msg: string, description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback): YargsInstance;
|
||||
};
|
||||
version: {
|
||||
(ver?: string | false): YargsInstance;
|
||||
(key?: string, ver?: string): YargsInstance;
|
||||
(key?: string, msg?: string, ver?: string): YargsInstance;
|
||||
};
|
||||
wrap(cols: number | null | undefined): YargsInstance;
|
||||
}
|
||||
export declare function isYargsInstance(y: YargsInstance | void): y is YargsInstance;
|
||||
/** Yargs' context. */
|
||||
export interface Context {
|
||||
commands: string[];
|
||||
files: string[];
|
||||
fullCommands: string[];
|
||||
}
|
||||
declare type LoggerInstance = Pick<Console, 'error' | 'log'>;
|
||||
export interface Options extends ParserOptions {
|
||||
__: Y18N['__'];
|
||||
alias: Dictionary<string[]>;
|
||||
array: string[];
|
||||
boolean: string[];
|
||||
choices: Dictionary<string[]>;
|
||||
config: Dictionary<ConfigCallback | boolean>;
|
||||
configObjects: Dictionary[];
|
||||
configuration: Configuration;
|
||||
count: string[];
|
||||
defaultDescription: Dictionary<string | undefined>;
|
||||
demandedCommands: Dictionary<{
|
||||
min: number;
|
||||
max: number;
|
||||
minMsg?: string | null;
|
||||
maxMsg?: string | null;
|
||||
}>;
|
||||
demandedOptions: Dictionary<string | undefined>;
|
||||
deprecatedOptions: Dictionary<string | boolean | undefined>;
|
||||
hiddenOptions: string[];
|
||||
/** Manually set keys */
|
||||
key: Dictionary<boolean | string>;
|
||||
local: string[];
|
||||
normalize: string[];
|
||||
number: string[];
|
||||
showHiddenOpt: string;
|
||||
skipValidation: string[];
|
||||
string: string[];
|
||||
}
|
||||
export interface Configuration extends Partial<ParserConfiguration> {
|
||||
/** Should a config object be deep-merged with the object config it extends? */
|
||||
'deep-merge-config'?: boolean;
|
||||
/** Should commands be sorted in help? */
|
||||
'sort-commands'?: boolean;
|
||||
}
|
||||
export interface OptionDefinition {
|
||||
alias?: string | string[];
|
||||
array?: boolean;
|
||||
boolean?: boolean;
|
||||
choices?: string | string[];
|
||||
coerce?: CoerceCallback;
|
||||
config?: boolean;
|
||||
configParser?: ConfigCallback;
|
||||
conflicts?: string | string[];
|
||||
count?: boolean;
|
||||
default?: any;
|
||||
defaultDescription?: string;
|
||||
deprecate?: string | boolean;
|
||||
deprecated?: OptionDefinition['deprecate'];
|
||||
desc?: string;
|
||||
describe?: OptionDefinition['desc'];
|
||||
description?: OptionDefinition['desc'];
|
||||
demand?: string | true;
|
||||
demandOption?: OptionDefinition['demand'];
|
||||
global?: boolean;
|
||||
group?: string;
|
||||
hidden?: boolean;
|
||||
implies?: string | number | KeyOrPos[];
|
||||
nargs?: number;
|
||||
normalize?: boolean;
|
||||
number?: boolean;
|
||||
require?: OptionDefinition['demand'];
|
||||
required?: OptionDefinition['demand'];
|
||||
requiresArg?: boolean;
|
||||
skipValidation?: boolean;
|
||||
string?: boolean;
|
||||
type?: 'array' | 'boolean' | 'count' | 'number' | 'string';
|
||||
}
|
||||
interface PositionalDefinition extends Pick<OptionDefinition, 'alias' | 'array' | 'coerce' | 'choices' | 'conflicts' | 'default' | 'defaultDescription' | 'demand' | 'desc' | 'describe' | 'description' | 'implies' | 'normalize'> {
|
||||
type?: 'boolean' | 'number' | 'string';
|
||||
}
|
||||
interface ParseCallback {
|
||||
(err: YError | string | undefined | null, argv: Arguments | Promise<Arguments>, output: string): void;
|
||||
}
|
||||
export interface Arguments extends ParserArguments {
|
||||
/** The script name or node command */
|
||||
$0: string;
|
||||
}
|
||||
export interface DetailedArguments extends ParserDetailedArguments {
|
||||
argv: Arguments;
|
||||
}
|
||||
export {};
|
||||
1190
node_modules/yargs/build/lib/yargs.js
generated
vendored
Normal file
1190
node_modules/yargs/build/lib/yargs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
node_modules/yargs/build/lib/yerror.d.ts
generated
vendored
Normal file
4
node_modules/yargs/build/lib/yerror.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare class YError extends Error {
|
||||
name: string;
|
||||
constructor(msg?: string | null);
|
||||
}
|
||||
11
node_modules/yargs/build/lib/yerror.js
generated
vendored
Normal file
11
node_modules/yargs/build/lib/yerror.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.YError = void 0;
|
||||
class YError extends Error {
|
||||
constructor(msg) {
|
||||
super(msg || 'yargs error');
|
||||
this.name = 'YError';
|
||||
Error.captureStackTrace(this, YError);
|
||||
}
|
||||
}
|
||||
exports.YError = YError;
|
||||
12
node_modules/yargs/index.js
generated
vendored
12
node_modules/yargs/index.js
generated
vendored
@@ -3,8 +3,9 @@
|
||||
// without running as a singleton do:
|
||||
// require('yargs/yargs')(process.argv.slice(2))
|
||||
const yargs = require('./yargs')
|
||||
const processArgv = require('./build/lib/process-argv')
|
||||
|
||||
Argv(process.argv.slice(2))
|
||||
Argv(processArgv.getProcessArgvWithoutBin())
|
||||
|
||||
module.exports = Argv
|
||||
|
||||
@@ -25,8 +26,15 @@ function singletonify (inst) {
|
||||
Object.keys(inst).forEach((key) => {
|
||||
if (key === 'argv') {
|
||||
Argv.__defineGetter__(key, inst.__lookupGetter__(key))
|
||||
} else if (typeof inst[key] === 'function') {
|
||||
Argv[key] = inst[key].bind(inst)
|
||||
} else {
|
||||
Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
|
||||
Argv.__defineGetter__('$0', () => {
|
||||
return inst.$0
|
||||
})
|
||||
Argv.__defineGetter__('parsed', () => {
|
||||
return inst.parsed
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
53
node_modules/yargs/lib/apply-extends.js
generated
vendored
53
node_modules/yargs/lib/apply-extends.js
generated
vendored
@@ -1,53 +0,0 @@
|
||||
|
||||
'use strict'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const YError = require('./yerror')
|
||||
|
||||
let previouslyVisitedConfigs = []
|
||||
|
||||
function checkForCircularExtends (cfgPath) {
|
||||
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
||||
throw new YError(`Circular extended configurations: '${cfgPath}'.`)
|
||||
}
|
||||
}
|
||||
|
||||
function getPathToDefaultConfig (cwd, pathToExtend) {
|
||||
return path.resolve(cwd, pathToExtend)
|
||||
}
|
||||
|
||||
function applyExtends (config, cwd) {
|
||||
let defaultConfig = {}
|
||||
|
||||
if (config.hasOwnProperty('extends')) {
|
||||
if (typeof config.extends !== 'string') return defaultConfig
|
||||
const isPath = /\.json|\..*rc$/.test(config.extends)
|
||||
let pathToDefault = null
|
||||
if (!isPath) {
|
||||
try {
|
||||
pathToDefault = require.resolve(config.extends)
|
||||
} catch (err) {
|
||||
// most likely this simply isn't a module.
|
||||
}
|
||||
} else {
|
||||
pathToDefault = getPathToDefaultConfig(cwd, config.extends)
|
||||
}
|
||||
// maybe the module uses key for some other reason,
|
||||
// err on side of caution.
|
||||
if (!pathToDefault && !isPath) return config
|
||||
|
||||
checkForCircularExtends(pathToDefault)
|
||||
|
||||
previouslyVisitedConfigs.push(pathToDefault)
|
||||
|
||||
defaultConfig = isPath ? JSON.parse(fs.readFileSync(pathToDefault, 'utf8')) : require(config.extends)
|
||||
delete config.extends
|
||||
defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault))
|
||||
}
|
||||
|
||||
previouslyVisitedConfigs = []
|
||||
|
||||
return Object.assign({}, defaultConfig, config)
|
||||
}
|
||||
|
||||
module.exports = applyExtends
|
||||
68
node_modules/yargs/lib/argsert.js
generated
vendored
68
node_modules/yargs/lib/argsert.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
// hoisted due to circular dependency on command.
|
||||
module.exports = argsert
|
||||
const command = require('./command')()
|
||||
const YError = require('./yerror')
|
||||
|
||||
const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']
|
||||
function argsert (expected, callerArguments, length) {
|
||||
// TODO: should this eventually raise an exception.
|
||||
try {
|
||||
// preface the argument description with "cmd", so
|
||||
// that we can run it through yargs' command parser.
|
||||
let position = 0
|
||||
let parsed = { demanded: [], optional: [] }
|
||||
if (typeof expected === 'object') {
|
||||
length = callerArguments
|
||||
callerArguments = expected
|
||||
} else {
|
||||
parsed = command.parseCommand(`cmd ${expected}`)
|
||||
}
|
||||
const args = [].slice.call(callerArguments)
|
||||
|
||||
while (args.length && args[args.length - 1] === undefined) args.pop()
|
||||
length = length || args.length
|
||||
|
||||
if (length < parsed.demanded.length) {
|
||||
throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`)
|
||||
}
|
||||
|
||||
const totalCommands = parsed.demanded.length + parsed.optional.length
|
||||
if (length > totalCommands) {
|
||||
throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`)
|
||||
}
|
||||
|
||||
parsed.demanded.forEach((demanded) => {
|
||||
const arg = args.shift()
|
||||
const observedType = guessType(arg)
|
||||
const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*')
|
||||
if (matchingTypes.length === 0) argumentTypeError(observedType, demanded.cmd, position, false)
|
||||
position += 1
|
||||
})
|
||||
|
||||
parsed.optional.forEach((optional) => {
|
||||
if (args.length === 0) return
|
||||
const arg = args.shift()
|
||||
const observedType = guessType(arg)
|
||||
const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*')
|
||||
if (matchingTypes.length === 0) argumentTypeError(observedType, optional.cmd, position, true)
|
||||
position += 1
|
||||
})
|
||||
} catch (err) {
|
||||
console.warn(err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
function guessType (arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return 'array'
|
||||
} else if (arg === null) {
|
||||
return 'null'
|
||||
}
|
||||
return typeof arg
|
||||
}
|
||||
|
||||
function argumentTypeError (observedType, allowedTypes, position, optional) {
|
||||
throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`)
|
||||
}
|
||||
437
node_modules/yargs/lib/command.js
generated
vendored
437
node_modules/yargs/lib/command.js
generated
vendored
@@ -1,437 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const inspect = require('util').inspect
|
||||
const isPromise = require('./is-promise')
|
||||
const { applyMiddleware, commandMiddlewareFactory } = require('./middleware')
|
||||
const path = require('path')
|
||||
const Parser = require('yargs-parser')
|
||||
|
||||
const DEFAULT_MARKER = /(^\*)|(^\$0)/
|
||||
|
||||
// handles parsing positional arguments,
|
||||
// and populating argv with said positional
|
||||
// arguments.
|
||||
module.exports = function command (yargs, usage, validation, globalMiddleware) {
|
||||
const self = {}
|
||||
let handlers = {}
|
||||
let aliasMap = {}
|
||||
let defaultCommand
|
||||
globalMiddleware = globalMiddleware || []
|
||||
|
||||
self.addHandler = function addHandler (cmd, description, builder, handler, commandMiddleware) {
|
||||
let aliases = []
|
||||
const middlewares = commandMiddlewareFactory(commandMiddleware)
|
||||
handler = handler || (() => {})
|
||||
|
||||
if (Array.isArray(cmd)) {
|
||||
aliases = cmd.slice(1)
|
||||
cmd = cmd[0]
|
||||
} else if (typeof cmd === 'object') {
|
||||
let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd)
|
||||
if (cmd.aliases) command = [].concat(command).concat(cmd.aliases)
|
||||
self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares)
|
||||
return
|
||||
}
|
||||
|
||||
// allow a module to be provided instead of separate builder and handler
|
||||
if (typeof builder === 'object' && builder.builder && typeof builder.handler === 'function') {
|
||||
self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares)
|
||||
return
|
||||
}
|
||||
|
||||
// parse positionals out of cmd string
|
||||
const parsedCommand = self.parseCommand(cmd)
|
||||
|
||||
// remove positional args from aliases only
|
||||
aliases = aliases.map(alias => self.parseCommand(alias).cmd)
|
||||
|
||||
// check for default and filter out '*''
|
||||
let isDefault = false
|
||||
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => {
|
||||
if (DEFAULT_MARKER.test(c)) {
|
||||
isDefault = true
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
// standardize on $0 for default command.
|
||||
if (parsedAliases.length === 0 && isDefault) parsedAliases.push('$0')
|
||||
|
||||
// shift cmd and aliases after filtering out '*'
|
||||
if (isDefault) {
|
||||
parsedCommand.cmd = parsedAliases[0]
|
||||
aliases = parsedAliases.slice(1)
|
||||
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd)
|
||||
}
|
||||
|
||||
// populate aliasMap
|
||||
aliases.forEach((alias) => {
|
||||
aliasMap[alias] = parsedCommand.cmd
|
||||
})
|
||||
|
||||
if (description !== false) {
|
||||
usage.command(cmd, description, isDefault, aliases)
|
||||
}
|
||||
|
||||
handlers[parsedCommand.cmd] = {
|
||||
original: cmd,
|
||||
description: description,
|
||||
handler,
|
||||
builder: builder || {},
|
||||
middlewares: middlewares || [],
|
||||
demanded: parsedCommand.demanded,
|
||||
optional: parsedCommand.optional
|
||||
}
|
||||
|
||||
if (isDefault) defaultCommand = handlers[parsedCommand.cmd]
|
||||
}
|
||||
|
||||
self.addDirectory = function addDirectory (dir, context, req, callerFile, opts) {
|
||||
opts = opts || {}
|
||||
// disable recursion to support nested directories of subcommands
|
||||
if (typeof opts.recurse !== 'boolean') opts.recurse = false
|
||||
// exclude 'json', 'coffee' from require-directory defaults
|
||||
if (!Array.isArray(opts.extensions)) opts.extensions = ['js']
|
||||
// allow consumer to define their own visitor function
|
||||
const parentVisit = typeof opts.visit === 'function' ? opts.visit : o => o
|
||||
// call addHandler via visitor function
|
||||
opts.visit = function visit (obj, joined, filename) {
|
||||
const visited = parentVisit(obj, joined, filename)
|
||||
// allow consumer to skip modules with their own visitor
|
||||
if (visited) {
|
||||
// check for cyclic reference
|
||||
// each command file path should only be seen once per execution
|
||||
if (~context.files.indexOf(joined)) return visited
|
||||
// keep track of visited files in context.files
|
||||
context.files.push(joined)
|
||||
self.addHandler(visited)
|
||||
}
|
||||
return visited
|
||||
}
|
||||
require('require-directory')({ require: req, filename: callerFile }, dir, opts)
|
||||
}
|
||||
|
||||
// lookup module object from require()d command and derive name
|
||||
// if module was not require()d and no name given, throw error
|
||||
function moduleName (obj) {
|
||||
const mod = require('which-module')(obj)
|
||||
if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)
|
||||
return commandFromFilename(mod.filename)
|
||||
}
|
||||
|
||||
// derive command name from filename
|
||||
function commandFromFilename (filename) {
|
||||
return path.basename(filename, path.extname(filename))
|
||||
}
|
||||
|
||||
function extractDesc (obj) {
|
||||
for (let keys = ['describe', 'description', 'desc'], i = 0, l = keys.length, test; i < l; i++) {
|
||||
test = obj[keys[i]]
|
||||
if (typeof test === 'string' || typeof test === 'boolean') return test
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
self.parseCommand = function parseCommand (cmd) {
|
||||
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ')
|
||||
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/)
|
||||
const bregex = /\.*[\][<>]/g
|
||||
const parsedCommand = {
|
||||
cmd: (splitCommand.shift()).replace(bregex, ''),
|
||||
demanded: [],
|
||||
optional: []
|
||||
}
|
||||
splitCommand.forEach((cmd, i) => {
|
||||
let variadic = false
|
||||
cmd = cmd.replace(/\s/g, '')
|
||||
if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) variadic = true
|
||||
if (/^\[/.test(cmd)) {
|
||||
parsedCommand.optional.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic
|
||||
})
|
||||
} else {
|
||||
parsedCommand.demanded.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic
|
||||
})
|
||||
}
|
||||
})
|
||||
return parsedCommand
|
||||
}
|
||||
|
||||
self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap))
|
||||
|
||||
self.getCommandHandlers = () => handlers
|
||||
|
||||
self.hasDefaultCommand = () => !!defaultCommand
|
||||
|
||||
self.runCommand = function runCommand (command, yargs, parsed, commandIndex) {
|
||||
let aliases = parsed.aliases
|
||||
const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand
|
||||
const currentContext = yargs.getContext()
|
||||
let numFiles = currentContext.files.length
|
||||
const parentCommands = currentContext.commands.slice()
|
||||
|
||||
// what does yargs look like after the buidler is run?
|
||||
let innerArgv = parsed.argv
|
||||
let innerYargs = null
|
||||
let positionalMap = {}
|
||||
if (command) {
|
||||
currentContext.commands.push(command)
|
||||
currentContext.fullCommands.push(commandHandler.original)
|
||||
}
|
||||
if (typeof commandHandler.builder === 'function') {
|
||||
// a function can be provided, which builds
|
||||
// up a yargs chain and possibly returns it.
|
||||
innerYargs = commandHandler.builder(yargs.reset(parsed.aliases))
|
||||
// if the builder function did not yet parse argv with reset yargs
|
||||
// and did not explicitly set a usage() string, then apply the
|
||||
// original command string as usage() for consistent behavior with
|
||||
// options object below.
|
||||
if (yargs.parsed === false) {
|
||||
if (shouldUpdateUsage(yargs)) {
|
||||
yargs.getUsageInstance().usage(
|
||||
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
|
||||
commandHandler.description
|
||||
)
|
||||
}
|
||||
innerArgv = innerYargs ? innerYargs._parseArgs(null, null, true, commandIndex) : yargs._parseArgs(null, null, true, commandIndex)
|
||||
} else {
|
||||
innerArgv = yargs.parsed.argv
|
||||
}
|
||||
|
||||
if (innerYargs && yargs.parsed === false) aliases = innerYargs.parsed.aliases
|
||||
else aliases = yargs.parsed.aliases
|
||||
} else if (typeof commandHandler.builder === 'object') {
|
||||
// as a short hand, an object can instead be provided, specifying
|
||||
// the options that a command takes.
|
||||
innerYargs = yargs.reset(parsed.aliases)
|
||||
if (shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs.getUsageInstance().usage(
|
||||
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
|
||||
commandHandler.description
|
||||
)
|
||||
}
|
||||
Object.keys(commandHandler.builder).forEach((key) => {
|
||||
innerYargs.option(key, commandHandler.builder[key])
|
||||
})
|
||||
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex)
|
||||
aliases = innerYargs.parsed.aliases
|
||||
}
|
||||
|
||||
if (!yargs._hasOutput()) {
|
||||
positionalMap = populatePositionals(commandHandler, innerArgv, currentContext, yargs)
|
||||
}
|
||||
|
||||
const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares || [])
|
||||
applyMiddleware(innerArgv, yargs, middlewares, true)
|
||||
|
||||
// we apply validation post-hoc, so that custom
|
||||
// checks get passed populated positional arguments.
|
||||
if (!yargs._hasOutput()) yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error)
|
||||
|
||||
if (commandHandler.handler && !yargs._hasOutput()) {
|
||||
yargs._setHasOutput()
|
||||
|
||||
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false)
|
||||
|
||||
const handlerResult = isPromise(innerArgv)
|
||||
? innerArgv.then(argv => commandHandler.handler(argv))
|
||||
: commandHandler.handler(innerArgv)
|
||||
|
||||
if (isPromise(handlerResult)) {
|
||||
handlerResult.catch(error =>
|
||||
yargs.getUsageInstance().fail(null, error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (command) {
|
||||
currentContext.commands.pop()
|
||||
currentContext.fullCommands.pop()
|
||||
}
|
||||
numFiles = currentContext.files.length - numFiles
|
||||
if (numFiles > 0) currentContext.files.splice(numFiles * -1, numFiles)
|
||||
|
||||
return innerArgv
|
||||
}
|
||||
|
||||
function shouldUpdateUsage (yargs) {
|
||||
return !yargs.getUsageInstance().getUsageDisabled() &&
|
||||
yargs.getUsageInstance().getUsage().length === 0
|
||||
}
|
||||
|
||||
function usageFromParentCommandsCommandHandler (parentCommands, commandHandler) {
|
||||
const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original
|
||||
const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c) })
|
||||
pc.push(c)
|
||||
return `$0 ${pc.join(' ')}`
|
||||
}
|
||||
|
||||
self.runDefaultBuilderOn = function (yargs) {
|
||||
if (shouldUpdateUsage(yargs)) {
|
||||
// build the root-level command string from the default string.
|
||||
const commandString = DEFAULT_MARKER.test(defaultCommand.original)
|
||||
? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ')
|
||||
yargs.getUsageInstance().usage(
|
||||
commandString,
|
||||
defaultCommand.description
|
||||
)
|
||||
}
|
||||
const builder = defaultCommand.builder
|
||||
if (typeof builder === 'function') {
|
||||
builder(yargs)
|
||||
} else {
|
||||
Object.keys(builder).forEach((key) => {
|
||||
yargs.option(key, builder[key])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// transcribe all positional arguments "command <foo> <bar> [apple]"
|
||||
// onto argv.
|
||||
function populatePositionals (commandHandler, argv, context, yargs) {
|
||||
argv._ = argv._.slice(context.commands.length) // nuke the current commands
|
||||
const demanded = commandHandler.demanded.slice(0)
|
||||
const optional = commandHandler.optional.slice(0)
|
||||
const positionalMap = {}
|
||||
|
||||
validation.positionalCount(demanded.length, argv._.length)
|
||||
|
||||
while (demanded.length) {
|
||||
const demand = demanded.shift()
|
||||
populatePositional(demand, argv, positionalMap)
|
||||
}
|
||||
|
||||
while (optional.length) {
|
||||
const maybe = optional.shift()
|
||||
populatePositional(maybe, argv, positionalMap)
|
||||
}
|
||||
|
||||
argv._ = context.commands.concat(argv._)
|
||||
|
||||
postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original))
|
||||
|
||||
return positionalMap
|
||||
}
|
||||
|
||||
function populatePositional (positional, argv, positionalMap, parseOptions) {
|
||||
const cmd = positional.cmd[0]
|
||||
if (positional.variadic) {
|
||||
positionalMap[cmd] = argv._.splice(0).map(String)
|
||||
} else {
|
||||
if (argv._.length) positionalMap[cmd] = [String(argv._.shift())]
|
||||
}
|
||||
}
|
||||
|
||||
// we run yargs-parser against the positional arguments
|
||||
// applying the same parsing logic used for flags.
|
||||
function postProcessPositionals (argv, positionalMap, parseOptions) {
|
||||
// combine the parsing hints we've inferred from the command
|
||||
// string with explicitly configured parsing hints.
|
||||
const options = Object.assign({}, yargs.getOptions())
|
||||
options.default = Object.assign(parseOptions.default, options.default)
|
||||
options.alias = Object.assign(parseOptions.alias, options.alias)
|
||||
options.array = options.array.concat(parseOptions.array)
|
||||
delete options.config // don't load config when processing positionals.
|
||||
|
||||
const unparsed = []
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
positionalMap[key].map((value) => {
|
||||
unparsed.push(`--${key}`)
|
||||
unparsed.push(value)
|
||||
})
|
||||
})
|
||||
|
||||
// short-circuit parse.
|
||||
if (!unparsed.length) return
|
||||
|
||||
const parsed = Parser.detailed(unparsed, options)
|
||||
|
||||
if (parsed.error) {
|
||||
yargs.getUsageInstance().fail(parsed.error.message, parsed.error)
|
||||
} else {
|
||||
// only copy over positional keys (don't overwrite
|
||||
// flag arguments that were already parsed).
|
||||
const positionalKeys = Object.keys(positionalMap)
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
[].push.apply(positionalKeys, parsed.aliases[key])
|
||||
})
|
||||
|
||||
Object.keys(parsed.argv).forEach((key) => {
|
||||
if (positionalKeys.indexOf(key) !== -1) {
|
||||
// any new aliases need to be placed in positionalMap, which
|
||||
// is used for validation.
|
||||
if (!positionalMap[key]) positionalMap[key] = parsed.argv[key]
|
||||
argv[key] = parsed.argv[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
self.cmdToParseOptions = function (cmdString) {
|
||||
const parseOptions = {
|
||||
array: [],
|
||||
default: {},
|
||||
alias: {},
|
||||
demand: {}
|
||||
}
|
||||
|
||||
const parsed = self.parseCommand(cmdString)
|
||||
parsed.demanded.forEach((d) => {
|
||||
const cmds = d.cmd.slice(0)
|
||||
const cmd = cmds.shift()
|
||||
if (d.variadic) {
|
||||
parseOptions.array.push(cmd)
|
||||
parseOptions.default[cmd] = []
|
||||
}
|
||||
cmds.forEach((c) => {
|
||||
parseOptions.alias[cmd] = c
|
||||
})
|
||||
parseOptions.demand[cmd] = true
|
||||
})
|
||||
|
||||
parsed.optional.forEach((o) => {
|
||||
const cmds = o.cmd.slice(0)
|
||||
const cmd = cmds.shift()
|
||||
if (o.variadic) {
|
||||
parseOptions.array.push(cmd)
|
||||
parseOptions.default[cmd] = []
|
||||
}
|
||||
cmds.forEach((c) => {
|
||||
parseOptions.alias[cmd] = c
|
||||
})
|
||||
})
|
||||
|
||||
return parseOptions
|
||||
}
|
||||
|
||||
self.reset = () => {
|
||||
handlers = {}
|
||||
aliasMap = {}
|
||||
defaultCommand = undefined
|
||||
return self
|
||||
}
|
||||
|
||||
// used by yargs.parse() to freeze
|
||||
// the state of commands such that
|
||||
// we can apply .parse() multiple times
|
||||
// with the same yargs instance.
|
||||
let frozen
|
||||
self.freeze = () => {
|
||||
frozen = {}
|
||||
frozen.handlers = handlers
|
||||
frozen.aliasMap = aliasMap
|
||||
frozen.defaultCommand = defaultCommand
|
||||
}
|
||||
self.unfreeze = () => {
|
||||
handlers = frozen.handlers
|
||||
aliasMap = frozen.aliasMap
|
||||
defaultCommand = frozen.defaultCommand
|
||||
frozen = undefined
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
115
node_modules/yargs/lib/completion.js
generated
vendored
115
node_modules/yargs/lib/completion.js
generated
vendored
@@ -1,115 +0,0 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
|
||||
// add bash completions to your
|
||||
// yargs-powered applications.
|
||||
module.exports = function completion (yargs, usage, command) {
|
||||
const self = {
|
||||
completionKey: 'get-yargs-completions'
|
||||
}
|
||||
|
||||
const zshShell = process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1
|
||||
// get a list of completion commands.
|
||||
// 'args' is the array of strings from the line to be completed
|
||||
self.getCompletion = function getCompletion (args, done) {
|
||||
const completions = []
|
||||
const current = args.length ? args[args.length - 1] : ''
|
||||
const argv = yargs.parse(args, true)
|
||||
const aliases = yargs.parsed.aliases
|
||||
const parentCommands = yargs.getContext().commands
|
||||
|
||||
// a custom completion function can be provided
|
||||
// to completion().
|
||||
if (completionFunction) {
|
||||
if (completionFunction.length < 3) {
|
||||
const result = completionFunction(current, argv)
|
||||
|
||||
// promise based completion function.
|
||||
if (typeof result.then === 'function') {
|
||||
return result.then((list) => {
|
||||
process.nextTick(() => { done(list) })
|
||||
}).catch((err) => {
|
||||
process.nextTick(() => { throw err })
|
||||
})
|
||||
}
|
||||
|
||||
// synchronous completion function.
|
||||
return done(result)
|
||||
} else {
|
||||
// asynchronous completion function
|
||||
return completionFunction(current, argv, (completions) => {
|
||||
done(completions)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const handlers = command.getCommandHandlers()
|
||||
for (let i = 0, ii = args.length; i < ii; ++i) {
|
||||
if (handlers[args[i]] && handlers[args[i]].builder) {
|
||||
const builder = handlers[args[i]].builder
|
||||
if (typeof builder === 'function') {
|
||||
const y = yargs.reset()
|
||||
builder(y)
|
||||
return y.argv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) {
|
||||
usage.getCommands().forEach((usageCommand) => {
|
||||
const commandName = command.parseCommand(usageCommand[0]).cmd
|
||||
if (args.indexOf(commandName) === -1) {
|
||||
if (!zshShell) {
|
||||
completions.push(commandName)
|
||||
} else {
|
||||
const desc = usageCommand[1] || ''
|
||||
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (current.match(/^-/) || (current === '' && completions.length === 0)) {
|
||||
const descs = usage.getDescriptions()
|
||||
Object.keys(yargs.getOptions().key).forEach((key) => {
|
||||
// If the key and its aliases aren't in 'args', add the key to 'completions'
|
||||
const keyAndAliases = [key].concat(aliases[key] || [])
|
||||
const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1)
|
||||
if (notInArgs) {
|
||||
if (!zshShell) {
|
||||
completions.push(`--${key}`)
|
||||
} else {
|
||||
const desc = descs[key] || ''
|
||||
completions.push(`--${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
done(completions)
|
||||
}
|
||||
|
||||
// generate the completion script to add to your .bashrc.
|
||||
self.generateCompletionScript = function generateCompletionScript ($0, cmd) {
|
||||
const templates = require('./completion-templates')
|
||||
let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate
|
||||
const name = path.basename($0)
|
||||
|
||||
// add ./to applications not yet installed as bin.
|
||||
if ($0.match(/\.js$/)) $0 = `./${$0}`
|
||||
|
||||
script = script.replace(/{{app_name}}/g, name)
|
||||
script = script.replace(/{{completion_command}}/g, cmd)
|
||||
return script.replace(/{{app_path}}/g, $0)
|
||||
}
|
||||
|
||||
// register a function to perform your own custom
|
||||
// completions., this function can be either
|
||||
// synchrnous or asynchronous.
|
||||
let completionFunction = null
|
||||
self.registerFunction = (fn) => {
|
||||
completionFunction = fn
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
32
node_modules/yargs/lib/decamelize.js
generated
vendored
32
node_modules/yargs/lib/decamelize.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
module.exports = (text, separator) => {
|
||||
separator = typeof separator === 'undefined' ? '_' : separator
|
||||
|
||||
return text
|
||||
.replace(/([a-z\d])([A-Z])/g, `$1${separator}$2`)
|
||||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, `$1${separator}$2`)
|
||||
.toLowerCase()
|
||||
}
|
||||
3
node_modules/yargs/lib/is-promise.js
generated
vendored
3
node_modules/yargs/lib/is-promise.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
module.exports = function isPromise (maybePromise) {
|
||||
return maybePromise instanceof Promise
|
||||
}
|
||||
65
node_modules/yargs/lib/middleware.js
generated
vendored
65
node_modules/yargs/lib/middleware.js
generated
vendored
@@ -1,65 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
// hoisted due to circular dependency on command.
|
||||
module.exports = {
|
||||
applyMiddleware,
|
||||
commandMiddlewareFactory,
|
||||
globalMiddlewareFactory
|
||||
}
|
||||
const isPromise = require('./is-promise')
|
||||
const argsert = require('./argsert')
|
||||
|
||||
function globalMiddlewareFactory (globalMiddleware, context) {
|
||||
return function (callback, applyBeforeValidation = false) {
|
||||
argsert('<array|function> [boolean]', [callback, applyBeforeValidation], arguments.length)
|
||||
if (Array.isArray(callback)) {
|
||||
for (let i = 0; i < callback.length; i++) {
|
||||
if (typeof callback[i] !== 'function') {
|
||||
throw Error('middleware must be a function')
|
||||
}
|
||||
callback[i].applyBeforeValidation = applyBeforeValidation
|
||||
}
|
||||
Array.prototype.push.apply(globalMiddleware, callback)
|
||||
} else if (typeof callback === 'function') {
|
||||
callback.applyBeforeValidation = applyBeforeValidation
|
||||
globalMiddleware.push(callback)
|
||||
}
|
||||
return context
|
||||
}
|
||||
}
|
||||
|
||||
function commandMiddlewareFactory (commandMiddleware) {
|
||||
if (!commandMiddleware) return []
|
||||
return commandMiddleware.map(middleware => {
|
||||
middleware.applyBeforeValidation = false
|
||||
return middleware
|
||||
})
|
||||
}
|
||||
|
||||
function applyMiddleware (argv, yargs, middlewares, beforeValidation) {
|
||||
const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true')
|
||||
return middlewares
|
||||
.reduce((accumulation, middleware) => {
|
||||
if (middleware.applyBeforeValidation !== beforeValidation &&
|
||||
!isPromise(accumulation)) {
|
||||
return accumulation
|
||||
}
|
||||
|
||||
if (isPromise(accumulation)) {
|
||||
return accumulation
|
||||
.then(initialObj =>
|
||||
Promise.all([initialObj, middleware(initialObj, yargs)])
|
||||
)
|
||||
.then(([initialObj, middlewareObj]) =>
|
||||
Object.assign(initialObj, middlewareObj)
|
||||
)
|
||||
} else {
|
||||
const result = middleware(argv, yargs)
|
||||
if (beforeValidation && isPromise(result)) throw beforeValidationError
|
||||
|
||||
return isPromise(result)
|
||||
? result.then(middlewareObj => Object.assign(accumulation, middlewareObj))
|
||||
: Object.assign(accumulation, result)
|
||||
}
|
||||
}, argv)
|
||||
}
|
||||
11
node_modules/yargs/lib/obj-filter.js
generated
vendored
11
node_modules/yargs/lib/obj-filter.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
'use strict'
|
||||
module.exports = function objFilter (original, filter) {
|
||||
const obj = {}
|
||||
filter = filter || ((k, v) => true)
|
||||
Object.keys(original || {}).forEach((key) => {
|
||||
if (filter(key, original[key])) {
|
||||
obj[key] = original[key]
|
||||
}
|
||||
})
|
||||
return obj
|
||||
}
|
||||
540
node_modules/yargs/lib/usage.js
generated
vendored
540
node_modules/yargs/lib/usage.js
generated
vendored
@@ -1,540 +0,0 @@
|
||||
'use strict'
|
||||
// this file handles outputting usage instructions,
|
||||
// failures, etc. keeps logging in one place.
|
||||
const decamelize = require('./decamelize')
|
||||
const stringWidth = require('string-width')
|
||||
const objFilter = require('./obj-filter')
|
||||
const path = require('path')
|
||||
const setBlocking = require('set-blocking')
|
||||
const YError = require('./yerror')
|
||||
|
||||
module.exports = function usage (yargs, y18n) {
|
||||
const __ = y18n.__
|
||||
const self = {}
|
||||
|
||||
// methods for ouputting/building failure message.
|
||||
const fails = []
|
||||
self.failFn = function failFn (f) {
|
||||
fails.push(f)
|
||||
}
|
||||
|
||||
let failMessage = null
|
||||
let showHelpOnFail = true
|
||||
self.showHelpOnFail = function showHelpOnFailFn (enabled, message) {
|
||||
if (typeof enabled === 'string') {
|
||||
message = enabled
|
||||
enabled = true
|
||||
} else if (typeof enabled === 'undefined') {
|
||||
enabled = true
|
||||
}
|
||||
failMessage = message
|
||||
showHelpOnFail = enabled
|
||||
return self
|
||||
}
|
||||
|
||||
let failureOutput = false
|
||||
self.fail = function fail (msg, err) {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
|
||||
if (fails.length) {
|
||||
for (let i = fails.length - 1; i >= 0; --i) {
|
||||
fails[i](msg, err, self)
|
||||
}
|
||||
} else {
|
||||
if (yargs.getExitProcess()) setBlocking(true)
|
||||
|
||||
// don't output failure message more than once
|
||||
if (!failureOutput) {
|
||||
failureOutput = true
|
||||
if (showHelpOnFail) {
|
||||
yargs.showHelp('error')
|
||||
logger.error()
|
||||
}
|
||||
if (msg || err) logger.error(msg || err)
|
||||
if (failMessage) {
|
||||
if (msg || err) logger.error('')
|
||||
logger.error(failMessage)
|
||||
}
|
||||
}
|
||||
|
||||
err = err || new YError(msg)
|
||||
if (yargs.getExitProcess()) {
|
||||
return yargs.exit(1)
|
||||
} else if (yargs._hasParseCallback()) {
|
||||
return yargs.exit(1, err)
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// methods for ouputting/building help (usage) message.
|
||||
let usages = []
|
||||
let usageDisabled = false
|
||||
self.usage = (msg, description) => {
|
||||
if (msg === null) {
|
||||
usageDisabled = true
|
||||
usages = []
|
||||
return
|
||||
}
|
||||
usageDisabled = false
|
||||
usages.push([msg, description || ''])
|
||||
return self
|
||||
}
|
||||
self.getUsage = () => {
|
||||
return usages
|
||||
}
|
||||
self.getUsageDisabled = () => {
|
||||
return usageDisabled
|
||||
}
|
||||
|
||||
self.getPositionalGroupName = () => {
|
||||
return __('Positionals:')
|
||||
}
|
||||
|
||||
let examples = []
|
||||
self.example = (cmd, description) => {
|
||||
examples.push([cmd, description || ''])
|
||||
}
|
||||
|
||||
let commands = []
|
||||
self.command = function command (cmd, description, isDefault, aliases) {
|
||||
// the last default wins, so cancel out any previously set default
|
||||
if (isDefault) {
|
||||
commands = commands.map((cmdArray) => {
|
||||
cmdArray[2] = false
|
||||
return cmdArray
|
||||
})
|
||||
}
|
||||
commands.push([cmd, description || '', isDefault, aliases])
|
||||
}
|
||||
self.getCommands = () => commands
|
||||
|
||||
let descriptions = {}
|
||||
self.describe = function describe (key, desc) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.describe(k, key[k])
|
||||
})
|
||||
} else {
|
||||
descriptions[key] = desc
|
||||
}
|
||||
}
|
||||
self.getDescriptions = () => descriptions
|
||||
|
||||
let epilog
|
||||
self.epilog = (msg) => {
|
||||
epilog = msg
|
||||
}
|
||||
|
||||
let wrapSet = false
|
||||
let wrap
|
||||
self.wrap = (cols) => {
|
||||
wrapSet = true
|
||||
wrap = cols
|
||||
}
|
||||
|
||||
function getWrap () {
|
||||
if (!wrapSet) {
|
||||
wrap = windowWidth()
|
||||
wrapSet = true
|
||||
}
|
||||
|
||||
return wrap
|
||||
}
|
||||
|
||||
const deferY18nLookupPrefix = '__yargsString__:'
|
||||
self.deferY18nLookup = str => deferY18nLookupPrefix + str
|
||||
|
||||
const defaultGroup = 'Options:'
|
||||
self.help = function help () {
|
||||
normalizeAliases()
|
||||
|
||||
// handle old demanded API
|
||||
const base$0 = path.basename(yargs.$0)
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
const groups = yargs.getGroups()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
let keys = []
|
||||
keys = keys.concat(Object.keys(descriptions))
|
||||
keys = keys.concat(Object.keys(demandedOptions))
|
||||
keys = keys.concat(Object.keys(demandedCommands))
|
||||
keys = keys.concat(Object.keys(options.default))
|
||||
keys = keys.filter(filterHiddenOptions)
|
||||
keys = Object.keys(keys.reduce((acc, key) => {
|
||||
if (key !== '_') acc[key] = true
|
||||
return acc
|
||||
}, {}))
|
||||
|
||||
const theWrap = getWrap()
|
||||
const ui = require('cliui')({
|
||||
width: theWrap,
|
||||
wrap: !!theWrap
|
||||
})
|
||||
|
||||
// the usage string.
|
||||
if (!usageDisabled) {
|
||||
if (usages.length) {
|
||||
// user-defined usage.
|
||||
usages.forEach((usage) => {
|
||||
ui.div(`${usage[0].replace(/\$0/g, base$0)}`)
|
||||
if (usage[1]) {
|
||||
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] })
|
||||
}
|
||||
})
|
||||
ui.div()
|
||||
} else if (commands.length) {
|
||||
let u = null
|
||||
// demonstrate how commands are used.
|
||||
if (demandedCommands._) {
|
||||
u = `${base$0} <${__('command')}>\n`
|
||||
} else {
|
||||
u = `${base$0} [${__('command')}]\n`
|
||||
}
|
||||
ui.div(`${u}`)
|
||||
}
|
||||
}
|
||||
|
||||
// your application's commands, i.e., non-option
|
||||
// arguments populated in '_'.
|
||||
if (commands.length) {
|
||||
ui.div(__('Commands:'))
|
||||
|
||||
const context = yargs.getContext()
|
||||
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''
|
||||
|
||||
if (yargs.getParserConfiguration()['sort-commands'] === true) {
|
||||
commands = commands.sort((a, b) => a[0].localeCompare(b[0]))
|
||||
}
|
||||
|
||||
commands.forEach((command) => {
|
||||
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
|
||||
ui.span(
|
||||
{
|
||||
text: commandString,
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
||||
},
|
||||
{ text: command[1] }
|
||||
)
|
||||
const hints = []
|
||||
if (command[2]) hints.push(`[${__('default:').slice(0, -1)}]`) // TODO hacking around i18n here
|
||||
if (command[3] && command[3].length) {
|
||||
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`)
|
||||
}
|
||||
if (hints.length) {
|
||||
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' })
|
||||
} else {
|
||||
ui.div()
|
||||
}
|
||||
})
|
||||
|
||||
ui.div()
|
||||
}
|
||||
|
||||
// perform some cleanup on the keys array, making it
|
||||
// only include top-level keys not their aliases.
|
||||
const aliasKeys = (Object.keys(options.alias) || [])
|
||||
.concat(Object.keys(yargs.parsed.newAliases) || [])
|
||||
|
||||
keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1))
|
||||
|
||||
// populate 'Options:' group with any keys that have not
|
||||
// explicitly had a group set.
|
||||
if (!groups[defaultGroup]) groups[defaultGroup] = []
|
||||
addUngroupedKeys(keys, options.alias, groups)
|
||||
|
||||
// display 'Options:' table along with any custom tables:
|
||||
Object.keys(groups).forEach((groupName) => {
|
||||
if (!groups[groupName].length) return
|
||||
|
||||
// if we've grouped the key 'f', but 'f' aliases 'foobar',
|
||||
// normalizedKeys should contain only 'foobar'.
|
||||
const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => {
|
||||
if (~aliasKeys.indexOf(key)) return key
|
||||
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey
|
||||
}
|
||||
return key
|
||||
})
|
||||
|
||||
if (normalizedKeys.length < 1) return
|
||||
|
||||
ui.div(__(groupName))
|
||||
|
||||
// actually generate the switches string --foo, -f, --bar.
|
||||
const switches = normalizedKeys.reduce((acc, key) => {
|
||||
acc[key] = [ key ].concat(options.alias[key] || [])
|
||||
.map(sw => {
|
||||
// for the special positional group don't
|
||||
// add '--' or '-' prefix.
|
||||
if (groupName === self.getPositionalGroupName()) return sw
|
||||
else return (sw.length > 1 ? '--' : '-') + sw
|
||||
})
|
||||
.join(', ')
|
||||
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
normalizedKeys.forEach((key) => {
|
||||
const kswitch = switches[key]
|
||||
let desc = descriptions[key] || ''
|
||||
let type = null
|
||||
|
||||
if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length))
|
||||
|
||||
if (~options.boolean.indexOf(key)) type = `[${__('boolean')}]`
|
||||
if (~options.count.indexOf(key)) type = `[${__('count')}]`
|
||||
if (~options.string.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.normalize.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.array.indexOf(key)) type = `[${__('array')}]`
|
||||
if (~options.number.indexOf(key)) type = `[${__('number')}]`
|
||||
|
||||
const extra = [
|
||||
type,
|
||||
(key in demandedOptions) ? `[${__('required')}]` : null,
|
||||
options.choices && options.choices[key] ? `[${__('choices:')} ${
|
||||
self.stringifiedValues(options.choices[key])}]` : null,
|
||||
defaultString(options.default[key], options.defaultDescription[key])
|
||||
].filter(Boolean).join(' ')
|
||||
|
||||
ui.span(
|
||||
{ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 },
|
||||
desc
|
||||
)
|
||||
|
||||
if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' })
|
||||
else ui.div()
|
||||
})
|
||||
|
||||
ui.div()
|
||||
})
|
||||
|
||||
// describe some common use-cases for your application.
|
||||
if (examples.length) {
|
||||
ui.div(__('Examples:'))
|
||||
|
||||
examples.forEach((example) => {
|
||||
example[0] = example[0].replace(/\$0/g, base$0)
|
||||
})
|
||||
|
||||
examples.forEach((example) => {
|
||||
if (example[1] === '') {
|
||||
ui.div(
|
||||
{
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2]
|
||||
}
|
||||
)
|
||||
} else {
|
||||
ui.div(
|
||||
{
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(examples, theWrap) + 4
|
||||
}, {
|
||||
text: example[1]
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
ui.div()
|
||||
}
|
||||
|
||||
// the usage string.
|
||||
if (epilog) {
|
||||
const e = epilog.replace(/\$0/g, base$0)
|
||||
ui.div(`${e}\n`)
|
||||
}
|
||||
|
||||
// Remove the trailing white spaces
|
||||
return ui.toString().replace(/\s*$/, '')
|
||||
}
|
||||
|
||||
// return the maximum width of a string
|
||||
// in the left-hand column of a table.
|
||||
function maxWidth (table, theWrap, modifier) {
|
||||
let width = 0
|
||||
|
||||
// table might be of the form [leftColumn],
|
||||
// or {key: leftColumn}
|
||||
if (!Array.isArray(table)) {
|
||||
table = Object.keys(table).map(key => [table[key]])
|
||||
}
|
||||
|
||||
table.forEach((v) => {
|
||||
width = Math.max(
|
||||
stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]),
|
||||
width
|
||||
)
|
||||
})
|
||||
|
||||
// if we've enabled 'wrap' we should limit
|
||||
// the max-width of the left-column.
|
||||
if (theWrap) width = Math.min(width, parseInt(theWrap * 0.5, 10))
|
||||
|
||||
return width
|
||||
}
|
||||
|
||||
// make sure any options set for aliases,
|
||||
// are copied to the keys being aliased.
|
||||
function normalizeAliases () {
|
||||
// handle old demanded API
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
;(Object.keys(options.alias) || []).forEach((key) => {
|
||||
options.alias[key].forEach((alias) => {
|
||||
// copy descriptions.
|
||||
if (descriptions[alias]) self.describe(key, descriptions[alias])
|
||||
// copy demanded.
|
||||
if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias])
|
||||
// type messages.
|
||||
if (~options.boolean.indexOf(alias)) yargs.boolean(key)
|
||||
if (~options.count.indexOf(alias)) yargs.count(key)
|
||||
if (~options.string.indexOf(alias)) yargs.string(key)
|
||||
if (~options.normalize.indexOf(alias)) yargs.normalize(key)
|
||||
if (~options.array.indexOf(alias)) yargs.array(key)
|
||||
if (~options.number.indexOf(alias)) yargs.number(key)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// given a set of keys, place any keys that are
|
||||
// ungrouped under the 'Options:' grouping.
|
||||
function addUngroupedKeys (keys, aliases, groups) {
|
||||
let groupedKeys = []
|
||||
let toCheck = null
|
||||
Object.keys(groups).forEach((group) => {
|
||||
groupedKeys = groupedKeys.concat(groups[group])
|
||||
})
|
||||
|
||||
keys.forEach((key) => {
|
||||
toCheck = [key].concat(aliases[key])
|
||||
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
||||
groups[defaultGroup].push(key)
|
||||
}
|
||||
})
|
||||
return groupedKeys
|
||||
}
|
||||
|
||||
function filterHiddenOptions (key) {
|
||||
return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt]
|
||||
}
|
||||
|
||||
self.showHelp = (level) => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
if (!level) level = 'error'
|
||||
const emit = typeof level === 'function' ? level : logger[level]
|
||||
emit(self.help())
|
||||
}
|
||||
|
||||
self.functionDescription = (fn) => {
|
||||
const description = fn.name ? decamelize(fn.name, '-') : __('generated-value')
|
||||
return ['(', description, ')'].join('')
|
||||
}
|
||||
|
||||
self.stringifiedValues = function stringifiedValues (values, separator) {
|
||||
let string = ''
|
||||
const sep = separator || ', '
|
||||
const array = [].concat(values)
|
||||
|
||||
if (!values || !array.length) return string
|
||||
|
||||
array.forEach((value) => {
|
||||
if (string.length) string += sep
|
||||
string += JSON.stringify(value)
|
||||
})
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
// format the default-value-string displayed in
|
||||
// the right-hand column.
|
||||
function defaultString (value, defaultDescription) {
|
||||
let string = `[${__('default:')} `
|
||||
|
||||
if (value === undefined && !defaultDescription) return null
|
||||
|
||||
if (defaultDescription) {
|
||||
string += defaultDescription
|
||||
} else {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
string += `"${value}"`
|
||||
break
|
||||
case 'object':
|
||||
string += JSON.stringify(value)
|
||||
break
|
||||
default:
|
||||
string += value
|
||||
}
|
||||
}
|
||||
|
||||
return `${string}]`
|
||||
}
|
||||
|
||||
// guess the width of the console window, max-width 80.
|
||||
function windowWidth () {
|
||||
const maxWidth = 80
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return Math.min(maxWidth, process.stdout.columns)
|
||||
} else {
|
||||
return maxWidth
|
||||
}
|
||||
}
|
||||
|
||||
// logic for displaying application version.
|
||||
let version = null
|
||||
self.version = (ver) => {
|
||||
version = ver
|
||||
}
|
||||
|
||||
self.showVersion = () => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
logger.log(version)
|
||||
}
|
||||
|
||||
self.reset = function reset (localLookup) {
|
||||
// do not reset wrap here
|
||||
// do not reset fails here
|
||||
failMessage = null
|
||||
failureOutput = false
|
||||
usages = []
|
||||
usageDisabled = false
|
||||
epilog = undefined
|
||||
examples = []
|
||||
commands = []
|
||||
descriptions = objFilter(descriptions, (k, v) => !localLookup[k])
|
||||
return self
|
||||
}
|
||||
|
||||
let frozen
|
||||
self.freeze = function freeze () {
|
||||
frozen = {}
|
||||
frozen.failMessage = failMessage
|
||||
frozen.failureOutput = failureOutput
|
||||
frozen.usages = usages
|
||||
frozen.usageDisabled = usageDisabled
|
||||
frozen.epilog = epilog
|
||||
frozen.examples = examples
|
||||
frozen.commands = commands
|
||||
frozen.descriptions = descriptions
|
||||
}
|
||||
self.unfreeze = function unfreeze () {
|
||||
failMessage = frozen.failMessage
|
||||
failureOutput = frozen.failureOutput
|
||||
usages = frozen.usages
|
||||
usageDisabled = frozen.usageDisabled
|
||||
epilog = frozen.epilog
|
||||
examples = frozen.examples
|
||||
commands = frozen.commands
|
||||
descriptions = frozen.descriptions
|
||||
frozen = undefined
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
341
node_modules/yargs/lib/validation.js
generated
vendored
341
node_modules/yargs/lib/validation.js
generated
vendored
@@ -1,341 +0,0 @@
|
||||
'use strict'
|
||||
const argsert = require('./argsert')
|
||||
const objFilter = require('./obj-filter')
|
||||
const specialKeys = ['$0', '--', '_']
|
||||
|
||||
// validation-type-stuff, missing params,
|
||||
// bad implications, custom checks.
|
||||
module.exports = function validation (yargs, usage, y18n) {
|
||||
const __ = y18n.__
|
||||
const __n = y18n.__n
|
||||
const self = {}
|
||||
|
||||
// validate appropriate # of non-option
|
||||
// arguments were provided, i.e., '_'.
|
||||
self.nonOptionCount = function nonOptionCount (argv) {
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
// don't count currently executing commands
|
||||
const _s = argv._.length - yargs.getContext().commands.length
|
||||
|
||||
if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
||||
if (_s < demandedCommands._.min) {
|
||||
if (demandedCommands._.minMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.minMsg ? demandedCommands._.minMsg.replace(/\$0/g, _s).replace(/\$1/, demandedCommands._.min) : null
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', _s, demandedCommands._.min)
|
||||
)
|
||||
}
|
||||
} else if (_s > demandedCommands._.max) {
|
||||
if (demandedCommands._.maxMsg !== undefined) {
|
||||
usage.fail(
|
||||
// replace $0 with observed, $1 with expected.
|
||||
demandedCommands._.maxMsg ? demandedCommands._.maxMsg.replace(/\$0/g, _s).replace(/\$1/, demandedCommands._.max) : null
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Too many non-option arguments: got %s, maximum of %s', _s, demandedCommands._.max)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// validate the appropriate # of <required>
|
||||
// positional arguments were provided:
|
||||
self.positionalCount = function positionalCount (required, observed) {
|
||||
if (observed < required) {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', observed, required)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// make sure all the required arguments are present.
|
||||
self.requiredArguments = function requiredArguments (argv) {
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
let missing = null
|
||||
|
||||
Object.keys(demandedOptions).forEach((key) => {
|
||||
if (!argv.hasOwnProperty(key) || typeof argv[key] === 'undefined') {
|
||||
missing = missing || {}
|
||||
missing[key] = demandedOptions[key]
|
||||
}
|
||||
})
|
||||
|
||||
if (missing) {
|
||||
const customMsgs = []
|
||||
Object.keys(missing).forEach((key) => {
|
||||
const msg = missing[key]
|
||||
if (msg && customMsgs.indexOf(msg) < 0) {
|
||||
customMsgs.push(msg)
|
||||
}
|
||||
})
|
||||
|
||||
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''
|
||||
|
||||
usage.fail(__n(
|
||||
'Missing required argument: %s',
|
||||
'Missing required arguments: %s',
|
||||
Object.keys(missing).length,
|
||||
Object.keys(missing).join(', ') + customMsg
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
// check for unknown arguments (strict-mode).
|
||||
self.unknownArguments = function unknownArguments (argv, aliases, positionalMap) {
|
||||
const commandKeys = yargs.getCommandInstance().getCommands()
|
||||
const unknown = []
|
||||
const currentContext = yargs.getContext()
|
||||
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
!positionalMap.hasOwnProperty(key) &&
|
||||
!yargs._getParseContext().hasOwnProperty(key) &&
|
||||
!aliases.hasOwnProperty(key)
|
||||
) {
|
||||
unknown.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
if (commandKeys.length > 0) {
|
||||
argv._.slice(currentContext.commands.length).forEach((key) => {
|
||||
if (commandKeys.indexOf(key) === -1) {
|
||||
unknown.push(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (unknown.length > 0) {
|
||||
usage.fail(__n(
|
||||
'Unknown argument: %s',
|
||||
'Unknown arguments: %s',
|
||||
unknown.length,
|
||||
unknown.join(', ')
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
// validate arguments limited to enumerated choices
|
||||
self.limitedChoices = function limitedChoices (argv) {
|
||||
const options = yargs.getOptions()
|
||||
const invalid = {}
|
||||
|
||||
if (!Object.keys(options.choices).length) return
|
||||
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
options.choices.hasOwnProperty(key)) {
|
||||
[].concat(argv[key]).forEach((value) => {
|
||||
// TODO case-insensitive configurability
|
||||
if (options.choices[key].indexOf(value) === -1 &&
|
||||
value !== undefined) {
|
||||
invalid[key] = (invalid[key] || []).concat(value)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const invalidKeys = Object.keys(invalid)
|
||||
|
||||
if (!invalidKeys.length) return
|
||||
|
||||
let msg = __('Invalid values:')
|
||||
invalidKeys.forEach((key) => {
|
||||
msg += `\n ${__(
|
||||
'Argument: %s, Given: %s, Choices: %s',
|
||||
key,
|
||||
usage.stringifiedValues(invalid[key]),
|
||||
usage.stringifiedValues(options.choices[key])
|
||||
)}`
|
||||
})
|
||||
usage.fail(msg)
|
||||
}
|
||||
|
||||
// custom checks, added using the `check` option on yargs.
|
||||
let checks = []
|
||||
self.check = function check (f, global) {
|
||||
checks.push({
|
||||
func: f,
|
||||
global
|
||||
})
|
||||
}
|
||||
|
||||
self.customChecks = function customChecks (argv, aliases) {
|
||||
for (let i = 0, f; (f = checks[i]) !== undefined; i++) {
|
||||
const func = f.func
|
||||
let result = null
|
||||
try {
|
||||
result = func(argv, aliases)
|
||||
} catch (err) {
|
||||
usage.fail(err.message ? err.message : err, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
usage.fail(__('Argument check failed: %s', func.toString()))
|
||||
} else if (typeof result === 'string' || result instanceof Error) {
|
||||
usage.fail(result.toString(), result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check implications, argument foo implies => argument bar.
|
||||
let implied = {}
|
||||
self.implies = function implies (key, value) {
|
||||
argsert('<string|object> [array|number|string]', [key, value], arguments.length)
|
||||
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.implies(k, key[k])
|
||||
})
|
||||
} else {
|
||||
yargs.global(key)
|
||||
if (!implied[key]) {
|
||||
implied[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.implies(key, i))
|
||||
} else {
|
||||
implied[key].push(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.getImplied = function getImplied () {
|
||||
return implied
|
||||
}
|
||||
|
||||
self.implications = function implications (argv) {
|
||||
const implyFail = []
|
||||
|
||||
Object.keys(implied).forEach((key) => {
|
||||
const origKey = key
|
||||
;(implied[key] || []).forEach((value) => {
|
||||
let num
|
||||
let key = origKey
|
||||
const origValue = value
|
||||
|
||||
// convert string '1' to number 1
|
||||
num = Number(key)
|
||||
key = isNaN(num) ? key : num
|
||||
|
||||
if (typeof key === 'number') {
|
||||
// check length of argv._
|
||||
key = argv._.length >= key
|
||||
} else if (key.match(/^--no-.+/)) {
|
||||
// check if key doesn't exist
|
||||
key = key.match(/^--no-(.+)/)[1]
|
||||
key = !argv[key]
|
||||
} else {
|
||||
// check if key exists
|
||||
key = argv[key]
|
||||
}
|
||||
|
||||
num = Number(value)
|
||||
value = isNaN(num) ? value : num
|
||||
|
||||
if (typeof value === 'number') {
|
||||
value = argv._.length >= value
|
||||
} else if (value.match(/^--no-.+/)) {
|
||||
value = value.match(/^--no-(.+)/)[1]
|
||||
value = !argv[value]
|
||||
} else {
|
||||
value = argv[value]
|
||||
}
|
||||
if (key && !value) {
|
||||
implyFail.push(` ${origKey} -> ${origValue}`)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (implyFail.length) {
|
||||
let msg = `${__('Implications failed:')}\n`
|
||||
|
||||
implyFail.forEach((value) => {
|
||||
msg += (value)
|
||||
})
|
||||
|
||||
usage.fail(msg)
|
||||
}
|
||||
}
|
||||
|
||||
let conflicting = {}
|
||||
self.conflicts = function conflicts (key, value) {
|
||||
argsert('<string|object> [array|string]', [key, value], arguments.length)
|
||||
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.conflicts(k, key[k])
|
||||
})
|
||||
} else {
|
||||
yargs.global(key)
|
||||
if (!conflicting[key]) {
|
||||
conflicting[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.conflicts(key, i))
|
||||
} else {
|
||||
conflicting[key].push(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.getConflicting = () => conflicting
|
||||
|
||||
self.conflicting = function conflictingFn (argv) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (conflicting[key]) {
|
||||
conflicting[key].forEach((value) => {
|
||||
// we default keys to 'undefined' that have been configured, we should not
|
||||
// apply conflicting check unless they are a value other than 'undefined'.
|
||||
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
self.recommendCommands = function recommendCommands (cmd, potentialCommands) {
|
||||
const distance = require('./levenshtein')
|
||||
const threshold = 3 // if it takes more than three edits, let's move on.
|
||||
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length)
|
||||
|
||||
let recommended = null
|
||||
let bestDistance = Infinity
|
||||
for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
|
||||
const d = distance(cmd, candidate)
|
||||
if (d <= threshold && d < bestDistance) {
|
||||
bestDistance = d
|
||||
recommended = candidate
|
||||
}
|
||||
}
|
||||
if (recommended) usage.fail(__('Did you mean %s?', recommended))
|
||||
}
|
||||
|
||||
self.reset = function reset (localLookup) {
|
||||
implied = objFilter(implied, (k, v) => !localLookup[k])
|
||||
conflicting = objFilter(conflicting, (k, v) => !localLookup[k])
|
||||
checks = checks.filter(c => c.global)
|
||||
return self
|
||||
}
|
||||
|
||||
let frozen
|
||||
self.freeze = function freeze () {
|
||||
frozen = {}
|
||||
frozen.implied = implied
|
||||
frozen.checks = checks
|
||||
frozen.conflicting = conflicting
|
||||
}
|
||||
self.unfreeze = function unfreeze () {
|
||||
implied = frozen.implied
|
||||
checks = frozen.checks
|
||||
conflicting = frozen.conflicting
|
||||
frozen = undefined
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
11
node_modules/yargs/lib/yerror.js
generated
vendored
11
node_modules/yargs/lib/yerror.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
'use strict'
|
||||
function YError (msg) {
|
||||
this.name = 'YError'
|
||||
this.message = msg || 'yargs error'
|
||||
Error.captureStackTrace(this, YError)
|
||||
}
|
||||
|
||||
YError.prototype = Object.create(Error.prototype)
|
||||
YError.prototype.constructor = YError
|
||||
|
||||
module.exports = YError
|
||||
11
node_modules/yargs/locales/be.json
generated
vendored
11
node_modules/yargs/locales/be.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "лік",
|
||||
"array": "масіў",
|
||||
"required": "неабходна",
|
||||
"default": "па змаўчанні",
|
||||
"default:": "па змаўчанні:",
|
||||
"choices:": "магчымасці:",
|
||||
"aliases:": "аліасы:",
|
||||
"generated-value": "згенераванае значэнне",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s",
|
||||
"other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s",
|
||||
"other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Не хапае значэння аргументу: %s",
|
||||
"other": "Не хапае значэнняў аргументаў: %s"
|
||||
|
||||
11
node_modules/yargs/locales/de.json
generated
vendored
11
node_modules/yargs/locales/de.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "Zahl",
|
||||
"array": "array",
|
||||
"required": "erforderlich",
|
||||
"default": "Standard",
|
||||
"default:": "Standard:",
|
||||
"choices:": "Möglichkeiten:",
|
||||
"aliases:": "Aliase:",
|
||||
"generated-value": "Generierter-Wert",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
|
||||
"other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
|
||||
"other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Fehlender Argumentwert: %s",
|
||||
"other": "Fehlende Argumentwerte: %s"
|
||||
|
||||
15
node_modules/yargs/locales/en.json
generated
vendored
15
node_modules/yargs/locales/en.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "number",
|
||||
"array": "array",
|
||||
"required": "required",
|
||||
"default": "default",
|
||||
"default:": "default:",
|
||||
"choices:": "choices:",
|
||||
"aliases:": "aliases:",
|
||||
"generated-value": "generated-value",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Not enough non-option arguments: got %s, need at least %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Too many non-option arguments: got %s, maximum of %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Not enough non-option arguments: got %s, need at least %s",
|
||||
"other": "Not enough non-option arguments: got %s, need at least %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Too many non-option arguments: got %s, maximum of %s",
|
||||
"other": "Too many non-option arguments: got %s, maximum of %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Missing argument value: %s",
|
||||
"other": "Missing argument values: %s"
|
||||
@@ -38,5 +45,7 @@
|
||||
"Did you mean %s?": "Did you mean %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
|
||||
"Positionals:": "Positionals:",
|
||||
"command": "command"
|
||||
"command": "command",
|
||||
"deprecated": "deprecated",
|
||||
"deprecated: %s": "deprecated: %s"
|
||||
}
|
||||
|
||||
11
node_modules/yargs/locales/es.json
generated
vendored
11
node_modules/yargs/locales/es.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "número",
|
||||
"array": "tabla",
|
||||
"required": "requerido",
|
||||
"default": "defecto",
|
||||
"default:": "defecto:",
|
||||
"choices:": "selección:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valor-generado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
|
||||
"other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
|
||||
"other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta argumento: %s",
|
||||
"other": "Faltan argumentos: %s"
|
||||
|
||||
49
node_modules/yargs/locales/fi.json
generated
vendored
Normal file
49
node_modules/yargs/locales/fi.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "Komennot:",
|
||||
"Options:": "Valinnat:",
|
||||
"Examples:": "Esimerkkejä:",
|
||||
"boolean": "totuusarvo",
|
||||
"count": "lukumäärä",
|
||||
"string": "merkkijono",
|
||||
"number": "numero",
|
||||
"array": "taulukko",
|
||||
"required": "pakollinen",
|
||||
"default": "oletusarvo",
|
||||
"default:": "oletusarvo:",
|
||||
"choices:": "vaihtoehdot:",
|
||||
"aliases:": "aliakset:",
|
||||
"generated-value": "generoitu-arvo",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s",
|
||||
"other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s",
|
||||
"other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argumentin arvo puuttuu: %s",
|
||||
"other": "Argumentin arvot puuttuvat: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Pakollinen argumentti puuttuu: %s",
|
||||
"other": "Pakollisia argumentteja puuttuu: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Tuntematon argumenttn: %s",
|
||||
"other": "Tuntemattomia argumentteja: %s"
|
||||
},
|
||||
"Invalid values:": "Virheelliset arvot:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s",
|
||||
"Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s",
|
||||
"Implications failed:": "Riippuvia argumentteja puuttuu:",
|
||||
"Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s",
|
||||
"Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s",
|
||||
"Path to JSON config file": "JSON-asetustiedoston polku",
|
||||
"Show help": "Näytä ohje",
|
||||
"Show version number": "Näytä versionumero",
|
||||
"Did you mean %s?": "Tarkoititko %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat",
|
||||
"Positionals:": "Sijaintiparametrit:",
|
||||
"command": "komento"
|
||||
}
|
||||
62
node_modules/yargs/locales/fr.json
generated
vendored
62
node_modules/yargs/locales/fr.json
generated
vendored
@@ -1,37 +1,53 @@
|
||||
{
|
||||
"Commands:": "Commandes:",
|
||||
"Options:": "Options:",
|
||||
"Examples:": "Exemples:",
|
||||
"Commands:": "Commandes :",
|
||||
"Options:": "Options :",
|
||||
"Examples:": "Exemples :",
|
||||
"boolean": "booléen",
|
||||
"count": "comptage",
|
||||
"string": "chaine de caractère",
|
||||
"count": "compteur",
|
||||
"string": "chaîne de caractères",
|
||||
"number": "nombre",
|
||||
"array": "tableau",
|
||||
"required": "requis",
|
||||
"default:": "défaut:",
|
||||
"choices:": "choix:",
|
||||
"default": "défaut",
|
||||
"default:": "défaut :",
|
||||
"choices:": "choix :",
|
||||
"aliases:": "alias :",
|
||||
"generated-value": "valeur générée",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Pas assez d'arguments non-option: reçu %s, besoin d'au moins %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Trop d'arguments non-option: reçu %s, maximum %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s",
|
||||
"other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Trop d'arguments (hors options) : reçu %s, maximum de %s",
|
||||
"other": "Trop d'arguments (hors options) : reçus %s, maximum de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argument manquant: %s",
|
||||
"other": "Arguments manquants: %s"
|
||||
"one": "Argument manquant : %s",
|
||||
"other": "Arguments manquants : %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Argument requis manquant: %s",
|
||||
"other": "Arguments requis manquants: %s"
|
||||
"one": "Argument requis manquant : %s",
|
||||
"other": "Arguments requis manquants : %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argument inconnu: %s",
|
||||
"other": "Arguments inconnus: %s"
|
||||
"one": "Argument inconnu : %s",
|
||||
"other": "Arguments inconnus : %s"
|
||||
},
|
||||
"Invalid values:": "Valeurs invalides:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Donné: %s, Choix: %s",
|
||||
"Argument check failed: %s": "Echec de la vérification de l'argument: %s",
|
||||
"Implications failed:": "Arguments dépendants manquants:",
|
||||
"Not enough arguments following: %s": "Pas assez d'arguments suivant: %s",
|
||||
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
|
||||
"Unknown command: %s": {
|
||||
"one": "Commande inconnue : %s",
|
||||
"other": "Commandes inconnues : %s"
|
||||
},
|
||||
"Invalid values:": "Valeurs invalides :",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s",
|
||||
"Argument check failed: %s": "Echec de la vérification de l'argument : %s",
|
||||
"Implications failed:": "Arguments dépendants manquants :",
|
||||
"Not enough arguments following: %s": "Pas assez d'arguments après : %s",
|
||||
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s",
|
||||
"Path to JSON config file": "Chemin du fichier de configuration JSON",
|
||||
"Show help": "Affiche de l'aide",
|
||||
"Show version number": "Affiche le numéro de version"
|
||||
"Show help": "Affiche l'aide",
|
||||
"Show version number": "Affiche le numéro de version",
|
||||
"Did you mean %s?": "Vouliez-vous dire %s ?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs",
|
||||
"Positionals:": "Arguments positionnels :",
|
||||
"command": "commande"
|
||||
}
|
||||
|
||||
11
node_modules/yargs/locales/hi.json
generated
vendored
11
node_modules/yargs/locales/hi.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "अंक",
|
||||
"array": "सरणी",
|
||||
"required": "आवश्यक",
|
||||
"default": "डिफॉल्ट",
|
||||
"default:": "डिफॉल्ट:",
|
||||
"choices:": "विकल्प:",
|
||||
"aliases:": "उपनाम:",
|
||||
"generated-value": "उत्पन्न-मूल्य",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है",
|
||||
"other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य",
|
||||
"other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "कुछ तर्को के मूल्य गुम हैं: %s",
|
||||
"other": "कुछ तर्को के मूल्य गुम हैं: %s"
|
||||
|
||||
11
node_modules/yargs/locales/hu.json
generated
vendored
11
node_modules/yargs/locales/hu.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "szám",
|
||||
"array": "tömb",
|
||||
"required": "kötelező",
|
||||
"default": "alapértelmezett",
|
||||
"default:": "alapértelmezett:",
|
||||
"choices:": "lehetőségek:",
|
||||
"aliases:": "aliaszok:",
|
||||
"generated-value": "generált-érték",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell",
|
||||
"other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet",
|
||||
"other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Hiányzó argumentum érték: %s",
|
||||
"other": "Hiányzó argumentum értékek: %s"
|
||||
|
||||
11
node_modules/yargs/locales/id.json
generated
vendored
11
node_modules/yargs/locales/id.json
generated
vendored
@@ -9,12 +9,19 @@
|
||||
"string": "string",
|
||||
"array": "larik",
|
||||
"required": "diperlukan",
|
||||
"default": "bawaan",
|
||||
"default:": "bawaan:",
|
||||
"aliases:": "istilah lain:",
|
||||
"choices:": "pilihan:",
|
||||
"generated-value": "nilai-yang-dihasilkan",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Argumen wajib kurang: hanya %s, minimal %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Terlalu banyak argumen wajib: ada %s, maksimal %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumen wajib kurang: hanya %s, minimal %s",
|
||||
"other": "Argumen wajib kurang: hanya %s, minimal %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Terlalu banyak argumen wajib: ada %s, maksimal %s",
|
||||
"other": "Terlalu banyak argumen wajib: ada %s, maksimal %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Kurang argumen: %s",
|
||||
"other": "Kurang argumen: %s"
|
||||
|
||||
11
node_modules/yargs/locales/it.json
generated
vendored
11
node_modules/yargs/locales/it.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "numero",
|
||||
"array": "vettore",
|
||||
"required": "richiesto",
|
||||
"default": "predefinito",
|
||||
"default:": "predefinito:",
|
||||
"choices:": "scelte:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valore generato",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s",
|
||||
"other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s",
|
||||
"other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argomento mancante: %s",
|
||||
"other": "Argomenti mancanti: %s"
|
||||
|
||||
21
node_modules/yargs/locales/ja.json
generated
vendored
21
node_modules/yargs/locales/ja.json
generated
vendored
@@ -8,15 +8,22 @@
|
||||
"number": "数値",
|
||||
"array": "配列",
|
||||
"required": "必須",
|
||||
"default": "デフォルト",
|
||||
"default:": "デフォルト:",
|
||||
"choices:": "選択してください:",
|
||||
"aliases:": "エイリアス:",
|
||||
"generated-value": "生成された値",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
|
||||
"other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
|
||||
"other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "引数が見つかりません: %s",
|
||||
"other": "引数が見つかりません: %s"
|
||||
"one": "引数の値が見つかりません: %s",
|
||||
"other": "引数の値が見つかりません: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "必須の引数が見つかりません: %s",
|
||||
@@ -27,7 +34,7 @@
|
||||
"other": "未知の引数です: %s"
|
||||
},
|
||||
"Invalid values:": "不正な値です:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "引数は %s です。指定できるのは %s つです。選択してください: %s",
|
||||
"Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s",
|
||||
"Argument check failed: %s": "引数のチェックに失敗しました: %s",
|
||||
"Implications failed:": "オプションの組み合わせで不正が生じました:",
|
||||
"Not enough arguments following: %s": "次の引数が不足しています。: %s",
|
||||
@@ -38,5 +45,7 @@
|
||||
"Did you mean %s?": "もしかして %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません",
|
||||
"Positionals:": "位置:",
|
||||
"command": "コマンド"
|
||||
"command": "コマンド",
|
||||
"deprecated": "非推奨",
|
||||
"deprecated: %s": "非推奨: %s"
|
||||
}
|
||||
|
||||
11
node_modules/yargs/locales/ko.json
generated
vendored
11
node_modules/yargs/locales/ko.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "숫자",
|
||||
"array": "배열",
|
||||
"required": "필수",
|
||||
"default": "기본",
|
||||
"default:": "기본:",
|
||||
"choices:": "선택:",
|
||||
"aliases:": "별칭:",
|
||||
"generated-value": "생성된 값",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다",
|
||||
"other": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다",
|
||||
"other": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "인자값을 받지 못했습니다: %s",
|
||||
"other": "인자값들을 받지 못했습니다: %s"
|
||||
|
||||
11
node_modules/yargs/locales/nb.json
generated
vendored
11
node_modules/yargs/locales/nb.json
generated
vendored
@@ -8,11 +8,18 @@
|
||||
"number": "nummer",
|
||||
"array": "matrise",
|
||||
"required": "obligatorisk",
|
||||
"default": "standard",
|
||||
"default:": "standard:",
|
||||
"choices:": "valg:",
|
||||
"generated-value": "generert-verdi",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s",
|
||||
"other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s",
|
||||
"other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Mangler argument verdi: %s",
|
||||
"other": "Mangler argument verdier: %s"
|
||||
|
||||
11
node_modules/yargs/locales/nl.json
generated
vendored
11
node_modules/yargs/locales/nl.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "getal",
|
||||
"array": "lijst",
|
||||
"required": "verplicht",
|
||||
"default": "standaard",
|
||||
"default:": "standaard:",
|
||||
"choices:": "keuzes:",
|
||||
"aliases:": "aliassen:",
|
||||
"generated-value": "gegenereerde waarde",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig",
|
||||
"other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s",
|
||||
"other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Missende argumentwaarde: %s",
|
||||
"other": "Missende argumentwaarden: %s"
|
||||
|
||||
13
node_modules/yargs/locales/nn.json
generated
vendored
13
node_modules/yargs/locales/nn.json
generated
vendored
@@ -8,13 +8,18 @@
|
||||
"number": "nummer",
|
||||
"array": "matrise",
|
||||
"required": "obligatorisk",
|
||||
"default": "standard",
|
||||
"default:": "standard:",
|
||||
"choices:": "val:",
|
||||
"generated-value": "generert-verdi",
|
||||
"Not enough non-option arguments: got %s, need at least %s":
|
||||
"Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s":
|
||||
"For mange ikkje-alternativ argument: fekk %s, maksimum %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s",
|
||||
"other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s",
|
||||
"other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Manglar argumentverdi: %s",
|
||||
"other": "Manglar argumentverdiar: %s"
|
||||
|
||||
11
node_modules/yargs/locales/pl.json
generated
vendored
11
node_modules/yargs/locales/pl.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "liczba",
|
||||
"array": "tablica",
|
||||
"required": "wymagany",
|
||||
"default": "domyślny",
|
||||
"default:": "domyślny:",
|
||||
"choices:": "dostępne:",
|
||||
"aliases:": "aliasy:",
|
||||
"generated-value": "wygenerowana-wartość",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
|
||||
"other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
|
||||
"other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Brak wartości dla argumentu: %s",
|
||||
"other": "Brak wartości dla argumentów: %s"
|
||||
|
||||
11
node_modules/yargs/locales/pt.json
generated
vendored
11
node_modules/yargs/locales/pt.json
generated
vendored
@@ -8,11 +8,18 @@
|
||||
"number": "número",
|
||||
"array": "arranjo",
|
||||
"required": "requerido",
|
||||
"default": "padrão",
|
||||
"default:": "padrão:",
|
||||
"choices:": "escolhas:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
|
||||
"other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
|
||||
"other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta valor de argumento: %s",
|
||||
"other": "Falta valores de argumento: %s"
|
||||
|
||||
10
node_modules/yargs/locales/pt_BR.json
generated
vendored
10
node_modules/yargs/locales/pt_BR.json
generated
vendored
@@ -12,8 +12,14 @@
|
||||
"choices:": "opções:",
|
||||
"aliases:": "sinônimos:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos: recebido %s, máximo de %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
|
||||
"other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Excesso de argumentos: recebido %s, máximo de %s",
|
||||
"other": "Excesso de argumentos: recebido %s, máximo de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta valor de argumento: %s",
|
||||
"other": "Falta valores de argumento: %s"
|
||||
|
||||
11
node_modules/yargs/locales/ru.json
generated
vendored
11
node_modules/yargs/locales/ru.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "число",
|
||||
"array": "массив",
|
||||
"required": "необходимо",
|
||||
"default": "по умолчанию",
|
||||
"default:": "по умолчанию:",
|
||||
"choices:": "возможности:",
|
||||
"aliases:": "алиасы:",
|
||||
"generated-value": "генерированное значение",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s",
|
||||
"other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s",
|
||||
"other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Не хватает значения аргумента: %s",
|
||||
"other": "Не хватает значений аргументов: %s"
|
||||
|
||||
11
node_modules/yargs/locales/th.json
generated
vendored
11
node_modules/yargs/locales/th.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "ตัวเลข",
|
||||
"array": "อาเรย์",
|
||||
"required": "จำเป็น",
|
||||
"default": "ค่าเริ่มต้",
|
||||
"default:": "ค่าเริ่มต้น",
|
||||
"choices:": "ตัวเลือก",
|
||||
"aliases:": "เอเลียส",
|
||||
"generated-value": "ค่าที่ถูกสร้างขึ้น",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า",
|
||||
"other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า",
|
||||
"other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s",
|
||||
"other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s"
|
||||
|
||||
11
node_modules/yargs/locales/tr.json
generated
vendored
11
node_modules/yargs/locales/tr.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "numara",
|
||||
"array": "array",
|
||||
"required": "zorunlu",
|
||||
"default": "varsayılan",
|
||||
"default:": "varsayılan:",
|
||||
"choices:": "seçimler:",
|
||||
"aliases:": "takma adlar:",
|
||||
"generated-value": "oluşturulan-değer",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
|
||||
"other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
|
||||
"other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Eksik argüman değeri: %s",
|
||||
"other": "Eksik argüman değerleri: %s"
|
||||
|
||||
11
node_modules/yargs/locales/zh_CN.json
generated
vendored
11
node_modules/yargs/locales/zh_CN.json
generated
vendored
@@ -8,11 +8,18 @@
|
||||
"number": "数字",
|
||||
"array": "数组",
|
||||
"required": "必需",
|
||||
"default": "默认值",
|
||||
"default:": "默认值:",
|
||||
"choices:": "可选值:",
|
||||
"generated-value": "生成的值",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
|
||||
"other": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
|
||||
"other": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "没有给此选项指定值:%s",
|
||||
"other": "没有给这些选项指定值:%s"
|
||||
|
||||
11
node_modules/yargs/locales/zh_TW.json
generated
vendored
11
node_modules/yargs/locales/zh_TW.json
generated
vendored
@@ -8,12 +8,19 @@
|
||||
"number": "數字",
|
||||
"array": "陣列",
|
||||
"required": "必須",
|
||||
"default": "預設值",
|
||||
"default:": "預設值:",
|
||||
"choices:": "可選值:",
|
||||
"aliases:": "別名:",
|
||||
"generated-value": "生成的值",
|
||||
"Not enough non-option arguments: got %s, need at least %s": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個",
|
||||
"Too many non-option arguments: got %s, maximum of %s": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個",
|
||||
"other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個",
|
||||
"other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "此引數無指定值:%s",
|
||||
"other": "這些引數無指定值:%s"
|
||||
|
||||
82
node_modules/yargs/package.json
generated
vendored
82
node_modules/yargs/package.json
generated
vendored
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"_from": "yargs@^13.3.0",
|
||||
"_id": "yargs@13.3.0",
|
||||
"_from": "yargs@^15.4.1",
|
||||
"_id": "yargs@15.4.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
|
||||
"_integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||
"_location": "/yargs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "yargs@^13.3.0",
|
||||
"raw": "yargs@^15.4.1",
|
||||
"name": "yargs",
|
||||
"escapedName": "yargs",
|
||||
"rawSpec": "^13.3.0",
|
||||
"rawSpec": "^15.4.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^13.3.0"
|
||||
"fetchSpec": "^15.4.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jest-runtime",
|
||||
"/jest/jest-cli"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
|
||||
"_shasum": "4c657a55e07e5f2cf947f8a366567c04a0dedc83",
|
||||
"_spec": "yargs@^13.3.0",
|
||||
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/jest/node_modules/jest-cli",
|
||||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||
"_shasum": "0d87a16de01aee9d8bec2bfbf74f67851730f4f8",
|
||||
"_spec": "yargs@^15.4.1",
|
||||
"_where": "/home/codespace/workspace/upload-google-play/node_modules/jest-runtime",
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/yargs/issues"
|
||||
},
|
||||
@@ -34,45 +34,54 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"cliui": "^5.0.0",
|
||||
"find-up": "^3.0.0",
|
||||
"cliui": "^6.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^4.1.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^3.0.0",
|
||||
"string-width": "^4.2.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^13.1.1"
|
||||
"yargs-parser": "^18.1.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/decamelize": "^1.2.0",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^3.0.0",
|
||||
"@typescript-eslint/parser": "^3.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
"coveralls": "^3.0.3",
|
||||
"chalk": "^4.0.0",
|
||||
"coveralls": "^3.0.9",
|
||||
"cpr": "^3.0.1",
|
||||
"cross-spawn": "^6.0.4",
|
||||
"cross-spawn": "^7.0.0",
|
||||
"es6-promise": "^4.2.5",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"gts": "^2.0.0-alpha.4",
|
||||
"hashish": "0.0.4",
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^14.1.0",
|
||||
"rimraf": "^2.6.3",
|
||||
"standard": "^12.0.1",
|
||||
"standard-version": "^6.0.1",
|
||||
"which": "^1.3.1",
|
||||
"mocha": "^7.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"standardx": "^5.0.0",
|
||||
"typescript": "^3.7.0",
|
||||
"which": "^2.0.0",
|
||||
"yargs-test-extends": "^1.0.1"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=6"
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"yargs.js",
|
||||
"lib",
|
||||
"build",
|
||||
"locales",
|
||||
"completion.sh.hbs",
|
||||
"completion.zsh.hbs",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://yargs.js.org/",
|
||||
@@ -93,15 +102,20 @@
|
||||
"url": "git+https://github.com/yargs/yargs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"pretest": "standard",
|
||||
"release": "standard-version",
|
||||
"test": "nyc --cache mocha --require ./test/before.js --timeout=12000 --check-leaks"
|
||||
"check": "standardx && standardx **/*.ts",
|
||||
"compile": "rimraf build && tsc",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"fix": "standardx --fix && standardx --fix **/*.ts",
|
||||
"posttest": "npm run check",
|
||||
"prepare": "npm run compile",
|
||||
"pretest": "npm run compile -- -p tsconfig.test.json",
|
||||
"test": "c8 mocha --require ./test/before.js --timeout=12000 --check-leaks"
|
||||
},
|
||||
"standard": {
|
||||
"standardx": {
|
||||
"ignore": [
|
||||
"build",
|
||||
"**/example/**"
|
||||
]
|
||||
},
|
||||
"version": "13.3.0"
|
||||
"version": "15.4.1"
|
||||
}
|
||||
|
||||
1210
node_modules/yargs/yargs.js
generated
vendored
1210
node_modules/yargs/yargs.js
generated
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user