How to use the cli.enable function in cli

To help you get started, we’ve selected a few cli 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 mozilla / apk-factory-service / node_modules / grunt-contrib-jshint / node_modules / jshint / src / cli / cli.js View on Github external
interpret: function (args) {
		cli.setArgv(args);
		cli.options = {};

		cli.enable("version", "glob", "help");
		cli.setApp(path.resolve(__dirname + "/../../package.json"));

		var options = cli.parse(OPTIONS);
		// Use config file if specified
		var config;
		if (options.config) {
			config = loadConfig(options.config);
		}

		switch (true) {
		// JSLint reporter
		case options.reporter === "jslint":
		case options["jslint-reporter"]:
			options.reporter = "../reporters/jslint_xml.js";
			break;
github IonicaBizau / ajs / bin / ajs.js View on Github external
#!/usr/bin/env node

var _     = require('underscore')
  , fs    = require('fs')
  , path  = require('path')
  , AJS  = require('../lib/ajs');

// node-cli clobbers process.argv. argh.
var argv = _.clone(process.argv);
var cli = require('cli').enable('version').setApp(__dirname + '/../package.json');
process.argv = argv;

cli.parse({
  tree:   ['t', 'Output the abstract syntax tree']
, source: ['s', 'Output the raw VM source']
});

cli.main(function (args, options) {
  var file = args[0]
    , base   = path.join(file);
  AJS.read(file, options);
});
github guardian / pasteup / build / node_modules / jshint / lib / cli.js View on Github external
var fs = require('fs'),
    path = require('path'),
    cli = require('cli').enable('glob', 'help'),
    hint = require('./hint');

function existsSync() {
    var obj = fs.existsSync ? fs : path;
    return obj.existsSync.apply(obj, arguments);
}

function _removeJsComments(str) {
    str = str || '';

    // replace everything between "/* */" in a non-greedy way
    // The English version of the regex is:
    //   match '/*'
    //   then match 0 or more instances of any character (including newlines)
    //     except for instances of '*/'
    //   then match '*/'
github inlife / nexrender / packages / nexrender-cli / src / index.js View on Github external
#!/usr/bin/env node
'use strict';

const os        = require('os');
const cli       = require('cli').enable('version');
const nexrender = { version: '1.0.0' }

// var m;
// try {
//     m = require(modulePath);
// } catch (e) {
//     if (e.code !== 'MODULE_NOT_FOUND') {
//         throw e;
//     }
//     m = backupModule;
// }

const server = require('@nexrender/server')
const node   = require('@nexrender/node')

cli.parse({
github jamesshore / object_playground / node_modules / cli / examples / glob.js View on Github external
#!/usr/bin/env node

var cli = require('cli').enable('glob');

//Running `./glob.js *.js` will output a list of .js files in this directory
console.log(cli.args);
github guardian / pasteup / build / node_modules / jshint / node_modules / cli / examples / glob.js View on Github external
#!/usr/bin/env node

var cli = require('cli').enable('glob');

//Running `./glob.js *.js` will output a list of .js files in this directory
console.log(cli.args);
github oklai / koala / src / app / node_modules / jshint / node_modules / cli / examples / glob.js View on Github external
#!/usr/bin/env node

var cli = require('cli').enable('glob');

//Running `./glob.js *.js` will output a list of .js files in this directory
console.log(cli.args);
github ReachFive / fake-smtp-server / index.js View on Github external
#!/usr/bin/env node
const SMTPServer = require('smtp-server').SMTPServer;
const simpleParser = require('mailparser').simpleParser;
const express = require("express");
const basicAuth = require('express-basic-auth');
const path = require("path");
const _ = require("lodash");
const moment = require("moment");
const cli = require('cli').enable('catchall').enable('status');

const config = cli.parse({
  'smtp-port': ['s', 'SMTP port to listen on', 'number', 1025],
  'smtp-ip': [false, 'IP Address to bind SMTP service to', 'ip', '0.0.0.0'],
  'http-port': ['h', 'HTTP port to listen on', 'number', 1080],
  'http-ip': [false, 'IP Address to bind HTTP service to', 'ip', '0.0.0.0'],
  whitelist: ['w', 'Only accept e-mails from these adresses. Accepts multiple e-mails comma-separated', 'string'],
  max: ['m', 'Max number of e-mails to keep', 'number', 100],
  auth: ['a', 'Enable Authentication', 'string'],
  headers: [false, 'Enable headers in responses']
});

const whitelist = config.whitelist ? config.whitelist.split(',') : [];

let users = null;
if (config.auth && !/.+:.+/.test(config.auth)) {
github urish / firebase-server / bin / firebase-server.js View on Github external
#!/usr/bin/env node

'use strict';

const process = require('process');
const fs = require('fs');
const path = require('path');
const cli = require('cli');
const debug = require('debug');
const pkg = require('../package.json');

cli.enable('version');
cli.setApp(pkg.name, pkg.version);

cli.parse({
	rest: ['e', 'Enable REST HTTP API'],
	verbose: ['v', 'Enable verbose (debug) output'],
	port: ['p', 'Listen on this port', 'number', 5000],
	address: ['a', 'Bind to this address', 'string'],
	daemon: ['b', 'Daemonize (run in background)'],
	pid: [false, 'Write PID to this path', 'string'],
	name: ['n', 'Hostname of the firebase server', 'string', 'localhost.firebaseio.test'],
	data: ['d', 'JSON data to bootstrap the server with', 'string', '{}'],
	file: ['f', 'JSON file to bootstrap the server with', 'file'],
	rules: ['r', 'JSON file with security rules to load', 'file'],
	secret: ['s', 'Shared client auth token secret', 'string'],
	version: [false, 'Output the version number'],
});
github smfoote / tornado / bin / tornado.es6 View on Github external
#!/usr/bin/env node

import cli from 'cli';
import fs from 'fs';
import {version} from '../package.json';

import parser from '../dist/parser';
import compiler from '../dist/compiler';

cli.enable('glob', 'version');

cli.setApp('tornado', version);

cli.setUsage(`${cli.app} [options] [path1 [path2 path3]]

  Compile all .td files in a directory:
${cli.app} --output=compiled.js templates/**/*.td`);

cli.parse({
  name: ['n', 'The name by which the template will be registered (defaults to path)', 'string'],
  output: ['o', 'Concatenate all output to this file', 'path'],
  split: ['s', 'Should the output files be split into their own files (true) or concatenated (false)', 'boolean'],
  pwd: [false, 'generate template names starting from this directory', 'string'],
  mode: ['m', 'Compling for `production` or `dev`', 'string']
});