How to use the args.Option function in args

To help you get started, we’ve selected a few args examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kriskowal / narwhal-lib / lib / narwhal / json.js View on Github external
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);
};
github kriskowal / narwhal-lib / lib / narwhal / json.js View on Github external
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);
};
github kriskowal / narwhal-lib / lib / narwhal / json.js View on Github external
parser.Option = function () {
    args.Option.apply(this, arguments);
    return this;
};
parser.Option.prototype = Object.create(args.Option.prototype);