How to use the yargs.argv.p function in yargs

To help you get started, we’ve selected a few yargs 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 pnp / pnpjs / .mocharc.js View on Github external
function getAllPackageFolderNames() {

    const root = resolve("./packages");
    return fs.readdirSync(root).filter(dirName => {
        const stat = fs.statSync(join(root, dirName));
        return stat && stat.isDirectory();
    });
}

let mode = "cmd";
let paths = ["./test/main.ts"];

// handle package specific config
if (yargs.packages || yargs.p) {

    const packageNames = (yargs.packages || yargs.p).split(",").map(s => s.trim().toLowerCase());

    const processingPackages = [];

    for (let i = 0; i < packageNames.length; i++) {

        // see of we have any package entries and pass them along as-is
        const found = getAllPackageFolderNames().filter(p => {
            return ((typeof p === "string" && p === packageNames[i]) || (p.name === packageNames[i]));
        });

        processingPackages.push(...found);
    }

    if (yargs.single || yargs.s) {
        // and only a single set of tests
        paths.push(resolve(`./test/${processingPackages[0]}/`, (yargs.single || yargs.s) + ".ts"));
github Workiva / wGulp / src / tasks / karma.js View on Github external
var karmaShim = {set: function(config) { this.config = config; }};
        var karmaConf = require(path.resolve(cwd, 'node_modules/wGulp/karma.conf.js'));
        karmaConf(karmaShim);
        var files = karmaShim.config.files;

        // Build karma options
        var karmaOptions = {
            action: 'run',
            configFile: options.karma
        };

        // Determine which browsers to run in based on CLI options
        if(argv.browsers){
            karmaOptions.browsers = argv.browsers.split(',');
        }
        else if(argv.c || argv.f || argv.p || argv.chrome || argv.firefox || argv.phantom) {
            karmaOptions.browsers = [];
            if(argv.chrome || argv.c){
                karmaOptions.browsers.push('Chrome');
            }
            if(argv.firefox || argv.f){
                karmaOptions.browsers.push('Firefox');
            }
            if(argv.phantom || argv.p){
                karmaOptions.browsers.push('PhantomJS');
            }
        }

        // Add SauceLabs configuration if user specified --sauce option
        if(argv.sauce && options.sauceLabs && options.sauceLabs.browsers){
            karmaOptions.customLaunchers = options.sauceLabs.browsers;
            karmaOptions.browsers = Object.keys(options.sauceLabs.browsers);
github microsoft / edge-diagnostics-adapter / src / edgeAdapter.ts View on Github external
if (argv.h || argv.help || argv["?"]) {
    console.log("node edgeAdapter.js ");
    console.log(":");
    console.log(" -p, --port=9999             The port to use for the edgeAdapter endpoint. (default 9222)");
    console.log(" --servetools<=9999>     Serve up an instance of the chrome devtools (must be installed)");
    console.log("                         at the optional specified port (default 9223).")
    console.log(" -u, --url<=http://foo.com>  Launch a new instance of Edge to the optionally specified url (default http://www.bing.com)");
    console.log(" -d, --diagnostics       Verbose log requests from client websocket and responses from service");
    console.log(" -h, --help              Display this help options");
    console.log("");
    console.log("Example:");
    console.log("node edgeAdapter.js");
    console.log("node edgeAdapter.js --port=8080 --servetools");
    console.log("node edgeAdapter.js --url=http://www.msn.com");
} else {
    const port = argv.port || argv.p || 9222;
    const url = argv.url || argv.u || null;
    const diagLogging = argv.diagnostics || argv.d || false;

    let chromeToolsPort = 0;
    if (argv.servetools) {
        if (typeof argv.servetools === 'number') {
            chromeToolsPort = argv.servetools;
        } else {
            chromeToolsPort = 9223
        }
    }

    var service = new EdgeAdapter.Service(diagLogging);
    service.run(port, chromeToolsPort, url);
    console.log(`Edge Diagnostics Adapter listening on port ${port}...`);
}
github liuyunzhuge / blog / h5_demo / gulpfile.js View on Github external
gulp.task('server', function () {
    yargs.p = yargs.p || 8083;
    browserSync.init({
        server: {
            baseDir: "./dist"
        },
        ui: {
            port: yargs.p + 1,
            weinre: {
                port: yargs.p + 2
            }
        },
        port: yargs.p,
        startPath: 'html/youku_summer.html'
    });
});
github trufflesuite / truffle / truffle.es6 View on Github external
registerTask('serve', "Serve app on localhost and rebuild changes as needed", function(done) {
  var config = Config.gather(truffle_dir, working_dir, argv, "development");
  console.log("Using environment " + config.environment + ".");
  Serve.start(config, argv.port || argv.p || "8080", function() {
    runTask("watch");
  });
});
github 1-electron / sprite / deploy / node_modules / yargs / example / bool.js View on Github external
#!/usr/bin/env node
var util = require('util');
var argv = require('yargs').argv;

if (argv.s) {
    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
}
console.log(
    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
);
github liuyunzhuge / blog / quick_layout / gulpfile.js View on Github external
gulp.task('server', function () {
    yargs.p = yargs.p || 8083;
    browserSync.init({
        server: {
            baseDir: "./dist"
        },
        ui: {
            port: yargs.p + 1,
            weinre: {
                port: yargs.p + 2
            }
        },
        port: yargs.p,
        startPath: 'html/demo.html'
    });
});
github allan2coder / react-ssr / app / lib / weui / gulpfile.js View on Github external
gulp.task('server', function () {
    yargs.p = yargs.p || 8080;
    browserSync.init({
        server: {
            baseDir: "./dist"
        },
        ui: {
            port: yargs.p + 1,
            weinre: {
                port: yargs.p + 2
            }
        },
        port: yargs.p,
        startPath: '/example'
    });
});
github sgtcloud / sgtcloud-html5-sdk / gulpfile.js View on Github external
gulp.task('default', ['lint'], function() {
	//发布到npm仓库
    if (yargs.p) {
        gulp.start('npm:publish');
    }
    //生成jsdoc
    if (yargs.g) {
        gulp.start('generateApi');
    }
    //启动排行榜教程服务器
    if (yargs.tutorials) {
        gulp.start('tutorials');
    }
    //监听
    if (yargs.w) {
        gulp.start('development');
    } else if (yargs.t) {	//测试
        gulp.start('run:test');
    } else {				//编译
github roots / sage / resources / assets / build / config.js View on Github external
const path = require('path');
const { argv } = require('yargs');
const merge = require('webpack-merge');

const desire = require('./util/desire');

const userConfig = merge(desire(`${__dirname}/../config`), desire(`${__dirname}/../config-local`));

const isProduction = !!((argv.env && argv.env.production) || argv.p);
const rootPath = (userConfig.paths && userConfig.paths.root)
  ? userConfig.paths.root
  : process.cwd();

const config = merge({
  open: true,
  copy: 'images/**/*',
  proxyUrl: 'http://localhost:3000',
  cacheBusting: '[name]_[hash]',
  paths: {
    root: rootPath,
    assets: path.join(rootPath, 'resources/assets'),
    dist: path.join(rootPath, 'dist'),
  },
  enabled: {
    sourceMaps: !isProduction,