mirror of
https://github.com/S2-/gitlit
synced 2025-08-04 13:10:09 +02:00
update dependencies
This commit is contained in:
60
node_modules/commander/index.js
generated
vendored
60
node_modules/commander/index.js
generated
vendored
@@ -43,9 +43,9 @@ exports.Option = Option;
|
||||
|
||||
function Option(flags, description) {
|
||||
this.flags = flags;
|
||||
this.required = ~flags.indexOf('<');
|
||||
this.optional = ~flags.indexOf('[');
|
||||
this.bool = !~flags.indexOf('-no-');
|
||||
this.required = flags.indexOf('<') >= 0;
|
||||
this.optional = flags.indexOf('[') >= 0;
|
||||
this.bool = flags.indexOf('-no-') === -1;
|
||||
flags = flags.split(/[ ,|]+/);
|
||||
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
|
||||
this.long = flags.shift();
|
||||
@@ -523,7 +523,7 @@ 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
|
||||
@@ -539,11 +539,14 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
// 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 +580,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);
|
||||
});
|
||||
@@ -660,6 +663,10 @@ Command.prototype.parseArgs = function(args, unknown) {
|
||||
if (unknown.length > 0) {
|
||||
this.unknownOption(unknown[0]);
|
||||
}
|
||||
if (this.commands.length === 0 &&
|
||||
this._args.filter(function(a) { return a.required }).length === 0) {
|
||||
this.emit('command:*');
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -785,9 +792,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);
|
||||
};
|
||||
|
||||
@@ -800,13 +805,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);
|
||||
};
|
||||
|
||||
@@ -819,9 +822,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);
|
||||
};
|
||||
|
||||
@@ -833,9 +834,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);
|
||||
};
|
||||
|
||||
@@ -1046,7 +1045,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');
|
||||
};
|
||||
@@ -1065,12 +1064,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');
|
||||
};
|
||||
@@ -1086,17 +1084,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('');
|
||||
}
|
||||
@@ -1107,8 +1105,7 @@ Command.prototype.helpInformation = function() {
|
||||
cmdName = cmdName + '|' + this._alias;
|
||||
}
|
||||
var usage = [
|
||||
'',
|
||||
' Usage: ' + cmdName + ' ' + this.usage(),
|
||||
'Usage: ' + cmdName + ' ' + this.usage(),
|
||||
''
|
||||
];
|
||||
|
||||
@@ -1117,9 +1114,8 @@ Command.prototype.helpInformation = function() {
|
||||
if (commandHelp) cmds = [commandHelp];
|
||||
|
||||
var options = [
|
||||
' Options:',
|
||||
'',
|
||||
'' + this.optionHelp().replace(/^/gm, ' '),
|
||||
'Options:',
|
||||
'' + this.optionHelp().replace(/^/gm, ' '),
|
||||
''
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user