示例#1
0
module.exports.run = function (raw) {
    var args = argv.run(raw);

    var colValues = _.values(_.pickBy(args.options, (v, k) =>  (_.indexOf(collectionOptions, k) >= 0)));

    var longest = _.reduce(colValues,
        function (acc, v, i) {
            if (i > 0) {
                return (v.length > acc) ? v.length : acc;
            } else {
                return v.length;
            }
        }, 0);

    args.collection = [];

    _.times(longest, (i) => {
        let o = _.omitBy(_.transform(_.pickBy(args.options, _.isArray), function (r, v, k) {
            return r[k] = v[i];
        }, {}), (v) => ((v == null) || (v == '')));
        args.collection.push(o);
    });

    args.options = keypath.expand(args.options);
    args.collection = _.map(args.collection, (v) => keypath.expand(v));
    return args;
};
/**
 * Runtime argument parsing
 */
function getRunTime() {
  var argv = require("argv");
  argv.option({
      name: 'username',
      type: 'string',
      description: 'Username for git',
      example: "'node install --username=username"
  });
  argv.option({
      name: 's3key',
      type: 'string',
      description: 'API key for Amazon Web Services\' S3',
      example: "'node install --s3key=abcdefg'"
  });
  argv.option({
      name: 's3secret',
      type: 'string',
      description: 'Secret key for Amazon Web Services\' S3',
      example: "'node install --s3key=abcdefg --s3secret=123456'"
  });
  argv.option({
      name: 'skipclone',
      type: 'string',
      description: 'Skip all \'git clone\' steps',
      example: "'node install --skipclone'"
  });
  argv.option({
      name: 'skipnpm',
      type: 'string',
      description: 'Skip all \'npm install\' and \'npm cache clean\' steps',
      example: "'node install --skipnpm'"
  });
  return argv.run().options;
}
示例#3
0
export default function release() {
  let args = argv.run();

  return function(done) {
    releaseIt.execute(args.options).catch(handleErrors).finally(done);
  }
}
/**
 * Runtime argument parsing
 */
function getRunTime() {
  var argv = require("argv");
  /*
  argv.option({
      name: 'argname',
      type: 'string',
      description: 'Argument description',
      example: "'node update --argname'"
  });
  */
  return argv.run().options;
}
示例#5
0
/**
 * Runtime argument parsing
 */
function getRunTime() {
  var argv = require("argv");
  argv.option({
      name: 'fullclone',
      type: 'string',
      description: 'Perform a clone with full commit history, rather than a shallow (i.e. latest-commits-only) clone',
      example: 'node update-webmaker --fullclone'
  });
  argv.option({
      name: 'fastforward',
      type: 'string',
      description: 'resume an update from where the update process was interrupted last time (if it was interrupted or crashed)',
      example: 'node update-webmaker --fastforward'
  });
  return argv.run().options;
}
示例#6
0
/**
 * Runtime argument parsing
 */
function getRunTime() {
  var argv = require("argv");
  argv.option({
      name: 'nomongo',
      type: 'string',
      description: 'Do not start mongodb (useful for when you already run mongo)',
      example: "'node run --nomongo'"
  });
  argv.option({
      name: 'noes',
      type: 'string',
      description: 'Do not start elastic search (useful for when you already run es)',
      example: "'node run --noes'"
  });
  argv.option({
      name: 'cleares',
      type: 'boolean',
      description: 'Clear the elasticsearch index when starting the suite, which makes webmaker think there are no makes.',
      example: "'node run --cleares'"
  });
  argv.option({
      name: 'exclude',
      type: 'list.string',
      description: 'Do not start specific apps. For convenience, apps named "xyz.webmaker.org" can be indicated as just "xyz".',
      example: "'node run --exclude=goggles,webmaker.org,htmlsanitizer.org,makeapi'"
  });
  var runtime = argv.run().options;
  runtime.excluded = function() { return false; }

  if(runtime.exclude) {
    runtime.exclude = runtime.exclude.split(",").map(function(v) { return v.toLowerCase(); });
    runtime.excluded = function(key) {
      key = key.toLowerCase();
      var excluded = (runtime.exclude.indexOf(key) !== -1);
      if(excluded) return true;
      key = key.replace(".webmaker.org",'');
      excluded = (runtime.exclude.indexOf(key) !== -1);
      return excluded;
    };
  }

  return runtime;
}
示例#7
0
function start() {
    var pjson = require('./package.json');
    console.log('Eat Daily Jam v ' + pjson.version);
    argv.version(pjson.version);
    argv.option({
        name: 'directory',
        short: 'd',
        type: 'path',
        description: 'Pot to put today\'s Jam in',
        example: "'EatDailyJam --directory=/your/music/folder' or 'EatDailyJam -d \"/Users/adrian/Music/iTunes/iTunes Media/Automatically Add to iTunes\"'"
    });
    var args = argv.run();
    if (!args || !args.options || !args.options.directory) {
        console.log('Please supply a directory using the -d option');
        argv.help();
        process.exit(1);
    } else {
        savePath = args.options.directory;
        fetchHTML();
    }
}
 function getOptions() {
     //console.log(argv.run());
     return argv.run().options;
 }
示例#9
0
	name: 'savefile',
	short: 's',
	type: 'string',
	description: '[Mondatory] Filename to save',
	example: "'"+ argv.name + " --savefile=value' or '" + argv.name + " -s value'"
    },
    {
	name: 'text',
	short: 't',
	type: 'string',
	description: '[Mondatory] Text to input TextToSpeech',
	example: "'"+ argv.name + " --text=value' or '" + argv.name + " -t value'"
    }
]);

var args = argv.run();

if( args.options.apikey === undefined || args.options.savefile === undefined
  || args.options.text === undefined ){
    console.log("Please add mondatory arguments. You can use help option('-h')");
    process.exit(0);
}

var apiKey = args.options.apikey;
var saveFile = args.options.savefile;
var speechText = args.options.text;

var docomo_api_url  = "https://api.apigw.smt.docomo.ne.jp/virtualNarrator/v1/textToSpeech?APIKEY="

var json = '{'+
    '  "Command": "AP_Synth",'+
示例#10
0
        if(err) throw err;
        if(list.length == 0){
            fs.writeFile("res.js", str + data, function (err) {
                if(err) throw err;
                minify('res.js', function(error, data) {
                    if (error)
                        console.error(error.message);
                    else
                        fs.writeFile("res.min.js", data, function (err) {
                            if(err) throw err
                        })
                });
            })
        }
        else combine(list, str + data + "\n")
    })
}

fs.readFile(argv.run().targets[0] || "../index.html", "utf-8", function (err, data) {
    if (err) throw err;
    data = data.toString().split("\n");
    while (data[data.length - 1] == "") {
        data.length--
    }
    var list = getList(data, '../');
    console.log(list);
    combine(list, "");
});


示例#11
0
var Config = require('./config.js');

var contestRef = require('./contestref.js').ref;

var argv = require('argv');
argv.option([
    {
        name: 'season',
        short: 's',
        type: 'string',
        description: 'Target season',
        example: "'tabulate-winners.js --season=20161' or 'tabulate-winners.js -s 20161'"
    }
]);
var argvrun = argv.run();
console.log(argvrun);

// 対象シーズン (20161)
var targetSeason, targetSeasonObj;
// ユーザテーブル、ユーザシークレットテーブル
var Users, Usersecrets;

// 書き込むデータ (順位、シーズンポイント、当選)
//var ready = {};
// 契約アカウント用
//var readyTriboxTeam = {};


// 配列のシャッフル
//  * http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript
示例#12
0
'use strict';

/**
 * コマンド引数の定義ファイル
 */

const argv = require('argv');

argv.option({
  name       : 'entry',
  short      : 'e',
  type       : 'string',
  description: 'エントリーポイントを指定します',
  example    : "'npm run build --entry=value' or 'npm run watch -e value'"
});

argv.option({
  name       : 'browserify_paths',
  short      : 'b',
  type       : 'string',
  description: 'Browserifyの起点となるパスを指定します',
  example    : "'npm run build --browserify_paths=/src/javascripts:./node_modules'"
});

module.exports = argv.run();
示例#13
0
argv.option({ name: 'bordercolor', type: 'string', description: 'Color of a border, either as a hex RRGGBB value or a hex CCMMYYKK value.' });
argv.option({ name: 'textcolor', type: 'string', description: 'Color of text, either as a hex RRGGBB value or a hex CCMMYYKK value.' });
argv.option({ name: 'addontextfont', type: 'string', description: 'The font name of the add on text.' });
argv.option({ name: 'addontextsize', type: 'int', description: 'The font size of the add on text in points.' });
argv.option({ name: 'addontextxoffset', type: 'int', description: 'Overrides the default positioning algorithm for the add on text.' });
argv.option({ name: 'addontextyoffset', type: 'int', description: 'Overrides the default positioning algorithm for the add on text.' });
argv.option({ name: 'guardwhitespace', type: 'boolean', description: 'Display white space guards.' });
argv.option({ name: 'guardwidth', type: 'int', description: 'Width of white space guards, in points.' });
argv.option({ name: 'guardheight', type: 'int', description: 'Height of white space guards, in points.' });
argv.option({ name: 'guardleftpos', type: 'int', description: 'Amount of white space to guard to left of the symbol, in points.' });
argv.option({ name: 'guardrightpos', type: 'int', description: 'Amount of white space to guard to right of the symbol, in points.' });
argv.option({ name: 'guardleftypos', type: 'int', description: 'Vertical position of the guard symbols on the left, in points.' });
argv.option({ name: 'guardrightypos', type: 'int', description: 'Vertical position of the guard symbols on the right, in points.' });


var commandLine = argv.run();

if (commandLine.targets.length === 0) {
	console.error('You must specify an output path.');
	process.exit(1);
}


if (commandLine.options.hasOwnProperty('textfont')) {
	var font = fs.readFileSync(path.join('fonts', commandLine.options.textfont), 'binary'); 
	bwipjs.loadFont(commandLine.options.textfont, 1, font);
}

bwipjs.toBuffer(commandLine.options, function (err, png) {
	if (err) {
		console.error('Can\'t generate a barcode: ' + err);
示例#14
0
/**
 * Runtime argument parsing
 */
function getRunTime() {
  var argv = require("argv");
  return argv.run().options;
}