Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var os = require("os");
var args = require("args");
var assert = require("test/assert");
var util = require("util");
var system = require("system");
var fs = require("file");
var parser = new args.Parser();
// syntax highlighting for option help
parser.Option = function () {
args.Option.apply(this, arguments);
return this;
};
parser.Option.prototype = Object.create(args.Option.prototype);
parser.Option.prototype.help = function (help) {
if (/->/.test(help)) {
help = help.replace(/\b[a-z]+\b/g, function (all) {
return '\0cyan(' + all + '\0)';
}).replace(/\b[A-Z]+\b/g, function (all) {
return '\0green(' + all + '\0)';
}).replace(/"[^"]+"/g, function (all) {
return '\0red(' + all + '\0)';
}).replace(/_/g, function (all) {
return '\0green(\0bold(' + all + '\0)\0)';
}).replace(/->|;/g, function (all) {
return '\0red(' + all + '\0)';
})
}
return args.Option.prototype.help.call(this, help);
};
parser.Option.prototype.help = function (help) {
if (/->/.test(help)) {
help = help.replace(/\b[a-z]+\b/g, function (all) {
return '\0cyan(' + all + '\0)';
}).replace(/\b[A-Z]+\b/g, function (all) {
return '\0green(' + all + '\0)';
}).replace(/"[^"]+"/g, function (all) {
return '\0red(' + all + '\0)';
}).replace(/_/g, function (all) {
return '\0green(\0bold(' + all + '\0)\0)';
}).replace(/->|;/g, function (all) {
return '\0red(' + all + '\0)';
})
}
return args.Option.prototype.help.call(this, help);
};
parser.Option = function () {
args.Option.apply(this, arguments);
return this;
};
parser.Option.prototype = Object.create(args.Option.prototype);