How to use the optimist.options function in optimist

To help you get started, we’ve selected a few optimist 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 typpo / autoreload / app.js View on Github external
#!/usr/bin/env node

var express = require('express')
  , http = require('http')
  , https = require('https')
  , fs = require('fs')
  , path = require('path')
  , process = require('process')
  , colors = require('colors')
  , autoreload = require('connect-autoreload')

var args = require('optimist')
    .options('port', {
      alias: 'p',
      default: 60000,
      describe: 'Port server listens on',
    })
    .options('delay', {
      alias: 'd',
      default: 150,
      describe: 'Delay before autoreloading',
    })
    .options('exclude', {
      alias: 'e',
      default: '\\.sw[poaxn]$',   // vim extensions
      describe: 'Regex matching files to exclude',
    })
    .options('regex_opts', {
github herenow / grf-extractor / index.js View on Github external
// Entry point
// Parse arguments and setup the enviroment

// Dependencies
var argv = require('optimist')
var _package = require('./package.json')
var Grf  = require('./lib/grf.js')
var ProgressBar = require('progress')
var Fs = require('fs')

// Setup args
argv.options('g', {
	alias: 'grf',
	describe: 'The grf file to be worked on.',
})
argv.options('s', {
	alias: 'search',
	describe: 'Search a single file on the .grf or a list of files separated by comma. RegExp are supported.',
})
argv.options('l', {
	alias: 'list',
	describe: 'List files inside the grf.',
})
argv.options('o', {
	alias: 'output',
	describe: 'Output directoy to write the extracted files to.',
})
argv.options('e', {
	alias: 'extract',
	describe: 'Extract a single file from the .grf, prints to stdout. Example: grf-extractor -e data/clientinfo.xml > clientinfo.xml',
})
argv.options('c', {
github Kong / guardian / tests / factual.js View on Github external
var request = require('request'),
  query = require('querystring'),
  args = require('optimist').
    options('key', { alias: 'k' }).
    options('secret', { alias: 's' }).
    options('signature', { alias: 'm', default: "HMAC-SHA1" }).
    argv;

var options = {
  url: 'http://api.v3.factual.com/t/places',
  method: 'GET'
};

if (!args.key) 
  throw new Error('Missing Consumer Key! -key cli option');

if (!args.secret) 
  throw new Error('Missing Consumer Secret! -secret cli option');
github azproduction / lmd / bin / lmd_actions / info.js View on Github external
module.exports = function (cli, argv, cwd) {
    for (var optionName in options) {
        optimist.options(optionName, options[optionName]);
    }

    argv = optimist.parse(argv);

    var buildName,
        status,
        mixinBuilds = argv._[1],
        sortOrder = argv.sort,
        isDeepAnalytics = argv.deep,
        lmdDir = path.join(cwd, '.lmd');

    if (mixinBuilds) {
        mixinBuilds = mixinBuilds.split('+');

        buildName = mixinBuilds.shift();
    }
github mapbox / cfn-config / bin / delete.js View on Github external
#!/usr/bin/env node

var _ = require('underscore');
var config = require('..');
var env = require('superenv')('cfn');
var optimist = require('optimist');

config.setCredentials(env.accessKeyId, env.secretAccessKey, env.bucket);

var argv = optimist
    .options('region', {
        describe: 'AWS region deployed the stack',
        demand: true,
        alias: 'r'
    })
    .options('name', {
        describe: 'Name of the AWS CloudFormation to deploy',
        demand: true,
        alias: 'n'
    })
    .options('force', {
        describe: 'Do not prompt',
        alias: 'f'
    })
    .argv;
github lazojs / lazo / run.js View on Github external
function parseArgs() {
    return require('optimist')
        .options('c', {
            alias: 'cluster'
        })
        .options('d', {
            alias: 'daemon'
        })
        .options('p', {
            alias: 'port',
            default: '8080'
        })
        .options('r', {
            alias: 'robust'
        })
        .boolean(['d', 'r'])
        .string(['p', 'c'])
        .argv;
github egorFiNE / node-stock / bin / dumpticks.js View on Github external
#!/usr/bin/env node

process.env.TZ = process.argv.indexOf('--cme')>=0 ? 
	'America/Chicago' : 
	'America/New_York';

require('date-utils');
require(__dirname+'/../ExtraDate');
require(__dirname+'/../ExtraNumber');
TickStorage = require(__dirname+'/../TickStorage');

var optimist = require('optimist')
	.options('dbpath', {
		demand: true
	})
	.options('market', {
		'boolean': true,
		describe: 'show only market ticks'
	})
	.options('cme', {
		'boolean': true,
		describe: 'use CME time zone'
	})
	.options('seek', {
		describe: 'seek to HH:MM[:SS]'
	})
	.usage("Run: dumpticks [args]  or 
github MobileChromeApps / mobile-chrome-apps / src / upgrade-project.js View on Github external
function upgradeProject(skipPrompt) {
  var argv = require('optimist')
      .options('link', { type: 'boolean' })
      .options('verbose', { type: 'boolean', alias: 'd' })
      .argv;
  var hadPlatforms = [];

  return Q()
  .then(function(){
    if (skipPrompt) return 'y';
    return utils.waitForKey('Warning: Upgrade will replace all files in platforms and plugins. Continue? [y/N] ');
  })
  .then(function(key) {
    if (key != 'y' && key != 'Y') {
      return Q.reject('Okay, nevermind.');
    }
  })
  .then(function() {
github bcoe / npm-tweets / bin / npm-tweets.js View on Github external
#!/usr/bin/env node

var NPMTweets = require('../lib').NPMTweets,
  optimist = require('optimist');

var argv = optimist
  .options('c', {
    alias: 'consumer_key',
    describe: 'twitter consumer token.'
  })
  .options('s', {
    alias: 'consumer_secret',
    describe: 'twitter consumer secret.'
  })
  .options('a', {
    alias: 'access_token',
    describe: 'twitter access token.'
  })
  .options('z', {
    alias: 'access_token_secret',
    describe: 'twitter access token secret.'
  })
github mapbox / cfn-config / bin / create.js View on Github external
#!/usr/bin/env node

var _ = require('underscore');
var config = require('..');
var env = require('superenv')('cfn');
var optimist = require('optimist');

config.setCredentials(env.accessKeyId, env.secretAccessKey, env.bucket);

var argv = optimist
    .options('template', {
        describe: 'AWS CloudFormation template to be deployed',
        demand: true,
        alias: 't'
    })
    .options('region', {
        describe: 'AWS region deployed the stack',
        demand: true,
        alias: 'r'
    })
    .options('name', {
        describe: 'Name of the AWS CloudFormation to deploy',
        demand: true,
        alias: 'n'
    })
    .options('config', {