How to use the cli.command 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 LoooooKe / policr / lib / policr.js View on Github external
cli.main(function(args, options){
    var tf = new TerraformRunner(options.workdir);
    if(cli.command == 'init') {
        tf.init();
    } else if(cli.command == 'destroy') {
        tf.destroy();
    } else if(cli.command == 'force-unlock') {
        tf.unlock(args[0]);
    } else if(cli.command == 'state') {
        tf.state(function() {
            // test
            var testRunner = new TestRunner(options.tests);
            testRunner.run();
        });
    } else if(cli.command == 'apply') {
            tf.apply(function(callback) {
                if(!options.skipTests) {
                    // test
                    var testRunner = new TestRunner(options.tests);
                    testRunner.run();
                } else {
                    console.log("Skipping tests...");
                }
github victorporof / Sublime-JSHint / scripts / node_modules / cli / examples / command.js View on Github external
#!/usr/bin/env node

var cli = require('cli');

//The second (optional) argument of cli.parse() is a command list 
//Type `./command.js --help` for usage info

//cli enables auto-completion of commands (similiar to npm), e.g. all of
//the following are equivalent and result in "Command is: install":
//    $ ./command.js install
//    $ ./command.js inst
//    $ ./command.js i

cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);

console.log('Command is: ' + cli.command);
github jonsavage / VaultGUI / node_modules / jshint / node_modules / cli / examples / command.js View on Github external
#!/usr/bin/env node

var cli = require('cli');

//The second (optional) argument of cli.parse() is a command list 
//Type `./command.js --help` for usage info

//cli enables auto-completion of commands (similiar to npm), e.g. all of
//the following are equivalent and result in "Command is: install":
//    $ ./command.js install
//    $ ./command.js inst
//    $ ./command.js i

cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);

console.log('Command is: ' + cli.command);
github RadLikeWhoa / Countable / node_modules / gulp-jshint / node_modules / jshint / node_modules / cli / examples / command.js View on Github external
#!/usr/bin/env node

var cli = require('cli');

//The second (optional) argument of cli.parse() is a command list 
//Type `./command.js --help` for usage info

//cli enables auto-completion of commands (similiar to npm), e.g. all of
//the following are equivalent and result in "Command is: install":
//    $ ./command.js install
//    $ ./command.js inst
//    $ ./command.js i

cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);

console.log('Command is: ' + cli.command);
github LoooooKe / policr / lib / policr.js View on Github external
cli.main(function(args, options){
    var tf = new TerraformRunner(options.workdir);
    if(cli.command == 'init') {
        tf.init();
    } else if(cli.command == 'destroy') {
        tf.destroy();
    } else if(cli.command == 'force-unlock') {
        tf.unlock(args[0]);
    } else if(cli.command == 'state') {
        tf.state(function() {
            // test
            var testRunner = new TestRunner(options.tests);
            testRunner.run();
        });
    } else if(cli.command == 'apply') {
            tf.apply(function(callback) {
                if(!options.skipTests) {
                    // test
                    var testRunner = new TestRunner(options.tests);
github Treefrog / A.mphibio.us / docs / build / node_modules / grunt-contrib-jshint / node_modules / jshint / node_modules / cli / examples / command.js View on Github external
#!/usr/bin/env node

var cli = require('cli');

//The second (optional) argument of cli.parse() is a command list 
//Type `./command.js --help` for usage info

//cli enables auto-completion of commands (similiar to npm), e.g. all of
//the following are equivalent and result in "Command is: install":
//    $ ./command.js install
//    $ ./command.js inst
//    $ ./command.js i

cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);

console.log('Command is: ' + cli.command);
github voloko / uki / tools / tools.js View on Github external
}
    
    var dev_server = require('dev_server');
    var fs = require('fs'),
        path = require('path');
        
    try {
        require(path.join(process.cwd(), 'express.js')).init(dev_server.app);
        util.puts("Loaded express.js");
    } catch(e) {}
    
    dev_server.init();
    dev_server.app.listen(port, host);
    util.puts("Server at http://" + (host || "127.0.0.1") + ":" + port.toString() + "/");
    
} else if (cli.command == 'build') {
    
    var static_require = require('./static_require');
    var file = cli.args[0];
    var options = { filePath: cli.args[0], squeeze: cli.options.squeeze };
    var code = static_require.require(options);
    console.log(code);
}
github geometria-lab / Beseda / bin / client.js View on Github external
cli.main(function(args, options) {
    checkArgs(args);

    if (cli.command == 'publish') {
        console.log(options.number + ' clients publishing ' + (options.number * args[2]) + ' messages...\n');
    }

    var clients   = [],
        connected = 0;

    for (var i = 0; i < options.number; i++) {
        var client = new Client(options);

        client.on('connection', function() {
            if (options.debug) {
                cli.info('Client ' + this.clientId + ' connected');
            }

            if (cli.command == 'subscribe') {
                subscribe(args, options, this);
github voloko / uki / tools / tools.js View on Github external
require.paths.unshift(__dirname);

var cli = require('cli'),
    options = cli.parse(
    {
        squeeze: ['s', 'Squeeze output']
    }, ['run', 'build']),
    util = require('util');
    
if (cli.command == 'run') {
    
    var pair = cli.args[0],
        host = '127.0.0.1',
        port = 21119,
        matches;
    if (pair) {
        if (pair.match(/^\d+$/)) {
            port = pair;
        } else if (matches = pair.match(/^(.*):(\d+)$/)) {
            host = matches[1];
            port = matches[2];
        } else {
            host = pair;
        }
    }
github nodearch / arch / bin / index.js View on Github external
let registry;

  if (appDir) {
    registry = await registryClient({
      logger: nodearch.logger,
      config: {
        location: nodearch.paths.extensions,
        keyword: 'nodearch-extension',
        app: appDir
      }
    });
  }


  switch (cli.command) {
    case 'start':
      appDir ? require(path.join(appDir, 'index.js')) : appNotExist();
      break;
    case 'console':
      if (appDir)  {
        nodearch.on(events.started, () => archConsole());
        require(path.join(appDir, 'index.js'));
      }
      else {
        appNotExist();
      }
      break;
    case 'add':
      appDir ? await registry.installPackages(cli.args) : appNotExist();
      break;
    case 'remove':