update deps
This commit is contained in:
66
node_modules/commander/index.js
generated
vendored
66
node_modules/commander/index.js
generated
vendored
@@ -484,7 +484,7 @@ Command.prototype.parse = function(argv) {
|
||||
})[0];
|
||||
}
|
||||
|
||||
if (this._execs[name] && typeof this._execs[name] !== 'function') {
|
||||
if (this._execs[name] === true) {
|
||||
return this.executeSubCommand(argv, args, parsed.unknown);
|
||||
} else if (aliasCommand) {
|
||||
// is alias of a subCommand
|
||||
@@ -523,27 +523,27 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
// executable
|
||||
var f = argv[1];
|
||||
// name of the subcommand, link `pm-install`
|
||||
var bin = basename(f, '.js') + '-' + args[0];
|
||||
var bin = basename(f, path.extname(f)) + '-' + args[0];
|
||||
|
||||
// In case of globally installed, get the base dir where executable
|
||||
// subcommand file should be located at
|
||||
var baseDir,
|
||||
link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f;
|
||||
var baseDir;
|
||||
|
||||
// when symbolink is relative path
|
||||
if (link !== f && link.charAt(0) !== '/') {
|
||||
link = path.join(dirname(f), link);
|
||||
}
|
||||
baseDir = dirname(link);
|
||||
var resolvedLink = fs.realpathSync(f);
|
||||
|
||||
baseDir = dirname(resolvedLink);
|
||||
|
||||
// prefer local `./<bin>` to bin in the $PATH
|
||||
var localBin = path.join(baseDir, bin);
|
||||
|
||||
// whether bin file is a js script with explicit `.js` extension
|
||||
// whether bin file is a js script with explicit `.js` or `.ts` extension
|
||||
var isExplicitJS = false;
|
||||
if (exists(localBin + '.js')) {
|
||||
bin = localBin + '.js';
|
||||
isExplicitJS = true;
|
||||
} else if (exists(localBin + '.ts')) {
|
||||
bin = localBin + '.ts';
|
||||
isExplicitJS = true;
|
||||
} else if (exists(localBin)) {
|
||||
bin = localBin;
|
||||
}
|
||||
@@ -577,9 +577,9 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
proc.on('close', process.exit.bind(process));
|
||||
proc.on('error', function(err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
console.error('\n %s(1) does not exist, try --help\n', bin);
|
||||
console.error('error: %s(1) does not exist, try --help', bin);
|
||||
} else if (err.code === 'EACCES') {
|
||||
console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
|
||||
console.error('error: %s(1) not executable. try chmod or run with root', bin);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -661,7 +661,7 @@ Command.prototype.parseArgs = function(args, unknown) {
|
||||
this.unknownOption(unknown[0]);
|
||||
}
|
||||
if (this.commands.length === 0 &&
|
||||
this._args.filter(function(a) { return a.required }).length === 0) {
|
||||
this._args.filter(function(a) { return a.required; }).length === 0) {
|
||||
this.emit('command:*');
|
||||
}
|
||||
}
|
||||
@@ -789,9 +789,7 @@ Command.prototype.opts = function() {
|
||||
*/
|
||||
|
||||
Command.prototype.missingArgument = function(name) {
|
||||
console.error();
|
||||
console.error(" error: missing required argument `%s'", name);
|
||||
console.error();
|
||||
console.error("error: missing required argument `%s'", name);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
@@ -804,13 +802,11 @@ Command.prototype.missingArgument = function(name) {
|
||||
*/
|
||||
|
||||
Command.prototype.optionMissingArgument = function(option, flag) {
|
||||
console.error();
|
||||
if (flag) {
|
||||
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
|
||||
console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
|
||||
} else {
|
||||
console.error(" error: option `%s' argument missing", option.flags);
|
||||
console.error("error: option `%s' argument missing", option.flags);
|
||||
}
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
@@ -823,9 +819,7 @@ Command.prototype.optionMissingArgument = function(option, flag) {
|
||||
|
||||
Command.prototype.unknownOption = function(flag) {
|
||||
if (this._allowUnknownOption) return;
|
||||
console.error();
|
||||
console.error(" error: unknown option `%s'", flag);
|
||||
console.error();
|
||||
console.error("error: unknown option `%s'", flag);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
@@ -837,9 +831,7 @@ Command.prototype.unknownOption = function(flag) {
|
||||
*/
|
||||
|
||||
Command.prototype.variadicArgNotLast = function(name) {
|
||||
console.error();
|
||||
console.error(" error: variadic arguments must be last `%s'", name);
|
||||
console.error();
|
||||
console.error("error: variadic arguments must be last `%s'", name);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
@@ -1050,7 +1042,7 @@ Command.prototype.optionHelp = function() {
|
||||
// Append the help information
|
||||
return this.options.map(function(option) {
|
||||
return pad(option.flags, width) + ' ' + option.description +
|
||||
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');
|
||||
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
|
||||
}).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
|
||||
.join('\n');
|
||||
};
|
||||
@@ -1069,12 +1061,11 @@ Command.prototype.commandHelp = function() {
|
||||
var width = this.padWidth();
|
||||
|
||||
return [
|
||||
' Commands:',
|
||||
'',
|
||||
'Commands:',
|
||||
commands.map(function(cmd) {
|
||||
var desc = cmd[1] ? ' ' + cmd[1] : '';
|
||||
return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
|
||||
}).join('\n').replace(/^/gm, ' '),
|
||||
}).join('\n').replace(/^/gm, ' '),
|
||||
''
|
||||
].join('\n');
|
||||
};
|
||||
@@ -1090,17 +1081,17 @@ Command.prototype.helpInformation = function() {
|
||||
var desc = [];
|
||||
if (this._description) {
|
||||
desc = [
|
||||
' ' + this._description,
|
||||
this._description,
|
||||
''
|
||||
];
|
||||
|
||||
var argsDescription = this._argsDescription;
|
||||
if (argsDescription && this._args.length) {
|
||||
var width = this.padWidth();
|
||||
desc.push(' Arguments:');
|
||||
desc.push('Arguments:');
|
||||
desc.push('');
|
||||
this._args.forEach(function(arg) {
|
||||
desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
|
||||
desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
|
||||
});
|
||||
desc.push('');
|
||||
}
|
||||
@@ -1111,8 +1102,7 @@ Command.prototype.helpInformation = function() {
|
||||
cmdName = cmdName + '|' + this._alias;
|
||||
}
|
||||
var usage = [
|
||||
'',
|
||||
' Usage: ' + cmdName + ' ' + this.usage(),
|
||||
'Usage: ' + cmdName + ' ' + this.usage(),
|
||||
''
|
||||
];
|
||||
|
||||
@@ -1121,9 +1111,8 @@ Command.prototype.helpInformation = function() {
|
||||
if (commandHelp) cmds = [commandHelp];
|
||||
|
||||
var options = [
|
||||
' Options:',
|
||||
'',
|
||||
'' + this.optionHelp().replace(/^/gm, ' '),
|
||||
'Options:',
|
||||
'' + this.optionHelp().replace(/^/gm, ' '),
|
||||
''
|
||||
];
|
||||
|
||||
@@ -1131,7 +1120,6 @@ Command.prototype.helpInformation = function() {
|
||||
.concat(desc)
|
||||
.concat(options)
|
||||
.concat(cmds)
|
||||
.concat([''])
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user