How to use the optimist.demand 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 prosociallearnEU / cf-nodejs-client / test / lib / model / cloudcontroller / ServiceBindingsTests.js View on Github external
/*jslint node: true*/
/*global describe: true, before:true, it: true*/
"use strict";

var Promise = require('bluebird');
var chai = require("chai"),
    expect = require("chai").expect;
var randomWords = require('random-words');

var argv = require('optimist').demand('config').argv;
var environment = argv.config;
var nconf = require('nconf');
nconf.argv().env().file({ file: 'config.json' });

var cf_api_url = nconf.get(environment + "_" + 'CF_API_URL'),
    username = nconf.get(environment + "_" + 'username'),
    password = nconf.get(environment + "_" + 'password');

var CloudController = require("../../../../lib/model/cloudcontroller/CloudController");
var CloudFoundryUsersUAA = require("../../../../lib/model/uaa/UsersUAA");
var CloudFoundryApps = require("../../../../lib/model/cloudcontroller/Apps");
var CloudFoundrySpaces = require("../../../../lib/model/cloudcontroller/Spaces");
var CloudFoundryUserProvidedServices = require("../../../../lib/model/cloudcontroller/UserProvidedServices");
var CloudFoundryServiceBindings = require("../../../../lib/model/cloudcontroller/ServiceBindings");
var BuildPacks = require("../../../../lib/model/cloudcontroller/BuildPacks");
CloudController = new CloudController();
github prosociallearnEU / cf-nodejs-client / test / lib / model / cloudcontroller / LoginTests.js View on Github external
/*jslint node: true*/
/*global describe: true, before: true, it: true*/
"use strict";

var Promise = require('bluebird');
var chai = require("chai"),
    chaiAsPromised = require("chai-as-promised"),
    expect = require("chai").expect;
chai.use(chaiAsPromised);

var argv = require('optimist').demand('config').argv;
var environment = argv.config;
var nconf = require('nconf');
nconf.argv().env().file({ file: 'config.json' });

var cf_api_url = nconf.get(environment + "_" + 'CF_API_URL'),
    username = nconf.get(environment + "_" + 'username'),
    password = nconf.get(environment + "_" + 'password');

var CloudController = require("../../../../lib/model/cloudcontroller/CloudController");
var CloudFoundryUsersUAA = require("../../../../lib/model/uaa/UsersUAA");
var CloudFoundryApps = require("../../../../lib/model/cloudcontroller/Apps");
CloudController = new CloudController();
CloudFoundryUsersUAA = new CloudFoundryUsersUAA();
CloudFoundryApps = new CloudFoundryApps();

describe("Cloud Foundry Authentication", function () {
github prosociallearnEU / cf-nodejs-client / test / lib / model / cloudcontroller / OrganizationsTests.js View on Github external
/*jslint node: true*/
/*global describe: true, before: true, it: true*/
"use strict";

var Promise = require('bluebird');
var chai = require("chai"),
    expect = require("chai").expect;

var argv = require('optimist').demand('config').argv;
var environment = argv.config;
var nconf = require('nconf');
nconf.argv().env().file({ file: 'config.json' });

var cf_api_url = nconf.get(environment + "_" + 'CF_API_URL'),
    username = nconf.get(environment + "_" + 'username'),
    password = nconf.get(environment + "_" + 'password');

var CloudController = require("../../../../lib/model/cloudcontroller/CloudController");
var CloudFoundryUsersUAA = require("../../../../lib/model/uaa/UsersUAA");
var CloudFoundryOrg = require("../../../../lib/model/cloudcontroller/Organizations");
var CloudFoundryOrgQuota = require("../../../../lib/model/cloudcontroller/OrganizationsQuota");
var CloudFoundrySpaces = require("../../../../lib/model/cloudcontroller/Spaces");
var CloudFoundryUsers = require("../../../../lib/model/cloudcontroller/Users");
CloudController = new CloudController();
CloudFoundryUsersUAA = new CloudFoundryUsersUAA();
github prosociallearnEU / cf-nodejs-client / test / lib / model / metrics / LogTests.js View on Github external
/*jslint node: true*/
/*global describe: true, before: true, it: true */
"use strict";

var Promise = require('bluebird');
var chai = require("chai"),
    expect = require("chai").expect;

var argv = require('optimist').demand('config').argv;
var environment = argv.config;
var nconf = require('nconf');
nconf.argv().env().file({ file: 'config.json' });

var cf_api_url = nconf.get(environment + "_" + 'CF_API_URL'),
    username = nconf.get(environment + "_" + 'username'),
    password = nconf.get(environment + "_" + 'password');

var CloudController = require("../../../../lib/model/cloudcontroller/CloudController");
var CloudFoundryUsersUAA = require("../../../../lib/model/uaa/UsersUAA");
var CloudFoundryApps = require("../../../../lib/model/cloudcontroller/Apps");
var CloudFoundryLogs = require("../../../../lib/model/metrics/Logs");
CloudController = new CloudController();
CloudFoundryUsersUAA = new CloudFoundryUsersUAA();
CloudFoundryApps = new CloudFoundryApps();
CloudFoundryLogs = new CloudFoundryLogs();
github nfriedly / Coin-Allocator / node_modules / yargs / example / demand_count.js View on Github external
#!/usr/bin/env node
var argv = require('optimist')
    .demand(2)
    .argv;
console.dir(argv)
github jimhigson / oboe.js-website / index.js View on Github external
var express = require('express'),
    gzippo = require('gzippo'),
    consolidate = require('consolidate'),
    readContent = require('./read-content.js'),
    readPagesList = require('./read-pages-list.js'),
    barrier = require('./barrier.js'),
    environment = require('optimist')
                    .demand(['env'])
                    .argv.env,
    
    PORT = '8888',

    isProd = (environment == 'prod'),  
    SCRIPTS = isProd? ['/js-concat/all.js'] : require('./sourceList.js'),

    CSS_STYLESHEETS = isProd? ["all-min.css"] : ["all.css"],
        
    LATEST_TAG = 'v2.0.0',
    ANALYTICS_ID = 'UA-47871814-1',
    RAW_REPO_LOCATION = 'https://raw.github.com/jimhigson/oboe.js',
    REPO_LOCATION = 'https://github.com/jimhigson/oboe.js',

    app = express();
github tonistiigi / mega / example / list.js View on Github external
var fs = require('fs')
var mega = require('../lib/mega')
var argv = require('optimist')
  .demand(2)
  .usage('USAGE: node example/list  \n' +
         '       node example/list   --download pattern\n' +
         '       node example/list   --monitor')
  .argv

var storage = mega({email: argv._[0], password:argv._[1], keepalive: !!argv.monitor})

storage.on('ready', function() {
  storage.mounts.forEach(function(f) {print(f)})

  for (var id in storage.files) {
    var f = storage.files[id]
    if (!f.directory) {
      if (f.name.indexOf(argv.download) != -1) {
        (function(f) {
github spion / npmsearch / bin / npmsearch.js View on Github external
#!/usr/bin/env node

var search = require('../lib/index.js');
var argv = require('optimist')
    .demand(1)
    .describe('exact',     "use exact keywords only (bool)")
    .describe('relevance', "relevance factor for sorting `number > 0` `default 0.25`")
    .describe('downloads', "downloads factor for sorting `number > 0` `default 1.5`")
    .describe('freshness', "freshness factor for sorting `number > 0` `default 0.5`")
    .describe('halflife',  "halflife of download count value in days")
    .describe('aging',     "halflife of package freshness in days")
    .describe('dataAge',   "maximum data age in (days) or update data from server")
    .describe('refresh',   "force data update (bool)")
    .argv

search(argv._, argv, function(err, results) {
    var limit = argv.limit || 7;
    for (var k = 0; k < Math.min(results.length, limit); ++k) {
        var details = results[k];
        var space = "    ";
github GreenInfo-Network / caliparks.org / gather.js View on Github external
var main = function() {

  var argv = require('optimist')
      .demand('t')
      .alias('t', 'type')
      .describe('t', 'type of harvest: flickr, foursquare_venues, foursquare_update, foursquare_nextvenues, twitter, instagram')
      .argv;

  if (argv.t == 'flickr') {

    flickr();

  } else if (argv.t == 'foursquare_venues') {

    foursquare();

  } else if (argv.t == 'foursquare_update') {

    getFullVenuesForAllVenues(process.exit);
github soheilpro / sqlcmd / sqlcmd.js View on Github external
#!/usr/bin/env node

var eol = require('os').EOL;
var sql = require('mssql');
var async = require('async');
var _ = require('underscore');

var argv = require('optimist')
    .demand(['s', 'u', 'p'])
    .alias('s', 'server')
    .alias('o', 'port')
    .alias('u', 'user')
    .alias('p', 'password')
    .alias('d', 'database')
    .alias('t', 'timeout')
    .alias('m', 'param')
    .describe('s', '')
    .describe('u', '')
    .describe('p', '')
    .describe('o', 'Default: 1433')
    .describe('d', 'Default: master')
    .describe('t', 'Default: 60 seconds')
    .describe('m', 'Format: param1=foo')
    .describe('no-quoted-identifier', 'Disable quoted identifiers.')