/** * Returns a parsed array of CLI arguments and options * * @since 3.0.0 * @alias lando.cli.argv * @return {Object} Yarg parsed options * @example * const argv = lando.cli.argv(); * @todo make this static and then fix all call sites */ argv() { return require('yargs').help(false).version(false).argv; }
yargonaut.style('green').errorsStyle('red'); const yargs = require('yargs'); const {clear, channel, experimental, secretToggle} = yargs.argv;
//check if URLs in requirements.json return 200 and generally point to their appropriate tools gulp.task('check-requirements', function(cb) { if(yargs.argv['skip-req-check']) { cb(); } else { exec('node test/check-requirements.js', common.createExecCallback(cb, false)); } });
gulp.task("build:scripts", function() { browserify.bundle() .pipe(vinyl_source("index.js")) .pipe(vinyl_buffer()) .pipe(gulp_if(yargs.argv.minify, gulp_uglify())) .pipe(gulp.dest("./build")) .pipe(gulp_connect.reload()) })
// eslint-disable-next-line const run = () => yargs .version(cliVersion) .commandDir(COMMAND_DIR) .demandCommand() .help() .argv
parseCommandLine() { let options = this._yargs(process.argv).default('windowsize','800x600').wrap(100); options.usage('Electron command line'); options.alias('ws', 'windowsize').string('ws').describe('ws','set window size (Ex: 800x600)'); options.alias('d', 'debug').boolean('1').describe('1', 'Autostart dev tools'); options.alias('u', 'userdata').string('u').describe('u', 'set userdata directory'); options.alias('v', 'version').boolean('v').describe('v', 'Print the version.'); options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.'); this._args = options.argv; if (this._args.help) { process.stdout.write(options.help()); process.exit(0); } if (this._args.version) { process.stdout.write(`Electron Version : ${process.versions.electron}\n`); process.stdout.write('GLBrowser Version : 0.0.1\n'); process.exit(0); } }
gulp.task("build:markup", function() { gulp.src("./source/index.html") .pipe(gulp_if(yargs.argv.minify, gulp_minify_html())) .pipe(gulp.dest("./build")) })
function init (data) { if (data && semver.gt(data.version, version)) { console.log(chalk.red(`------ You're running gloria in version ${version}, the latest version is ${data.version}. Run 'npm install -g gloria' to get the latest version ------`)); } // Using yargs to identify commands and arguments // https://www.npmjs.com/package/yargs require(`yargs`) .commandDir(`../commands`) .alias('v', 'version') .version(require(`../version`)) .help() .usage(`Gloria is a static site generator. Use the command init to get started.`) .epilogue(`For more information, check out the documentation in github.com/gloriajs/gloria`) .argv; }
gulp.task( 'test:unit', 'run unit tests', function(done) { var argv = require('yargs') .default('grep', null, 'test grep') .default('reporter', 'nyan', 'test reporter') .argv; gulp.src(['./**/tests/unit/*.spec.js']) .pipe(mocha({ grep: argv.grep, reporter: argv.reporter, timeout: 60000 })) .on('end', done); } );
gulp.task('unit-test-1by1', function() { return globby('test/unit/**/*.js', {root: '.'}).then(function(files) { files.reduce((promises, file) => { return promises.then(function() { return new Promise(function(resolve) { gulp.src([file], { read: false }).pipe(mocha({ recursive: false, require: 'babel-core/register', env: { NODE_PATH: '.' }, grep: yargs.argv.grep, g: yargs.argv.g, reporter: yargs.argv.reporter })).on('end', resolve); }); }); }, Promise.resolve()); }); });
gulp.task( 'adWords:campaignService:query', 'queries Google AdWords campaigns', function(cb) { var argv = require('yargs') .default( 'clientCustomerId', process.env.ADWORDS_CLIENT_CUSTOMER_ID, 'clientCustomerId of account' ) .default('validateOnly', false, 'validate only') .argv; var AdWords = require('..'); var service = new AdWords.CampaignService() .setValidateOnly(argv.validateOnly) .setVerbose(true); var query = 'SELECT Id, Name, Status ORDER BY Name'; service.query(argv.clientCustomerId, query, function(err, results) { if (err) return cb(err); else console.log(JSON.stringify(results, null, 2)); return cb(err); }); } );
gulp.task('unit-test', function() { return gulp.src([yargs.argv['spec-file'] || 'test/unit/**/*.js'], { read: false }).pipe(mocha({ recursive: true, require: 'babel-core/register', env: { NODE_PATH: '.' }, grep: yargs.argv.grep, g: yargs.argv.g, reporter: yargs.argv.reporter, istanbul: { report: yargs.argv.report || 'lcov' } })).on('end', function() { if(yargs.argv['open-report']) { gulp.src(path.join('coverage', 'lcov-report', 'index.html')).pipe(open()); } }); });
gulp.task("build:styles", function() { gulp.src("./source/index.scss") .pipe(gulp_sass()) .pipe(gulp_prefixify_css()) .pipe(gulp_if(yargs.argv.minify, gulp_minify_css())) .pipe(gulp.dest("./build")) .pipe(gulp_connect.reload()) })
gulp.task( 'test:integration', 'run integration tests', function(done) { var argv = require('yargs') .default('grep', null, 'test grep') .default('reporter', 'nyan', 'test reporter') .argv; gulp.src(['./**/tests/integration/*.spec.js']) .pipe(mocha({ grep: argv.grep, reporter: argv.reporter, timeout: 60000 })) .on('end', done); } );