How to use the yargs.argv.name 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 dhowe / RiTaJSHistory / gulpfile.js View on Github external
gulp.task('test.node.pkg', function(cb) {

        var testrunner = require("qunit");

        var tests = [
            'test/LibStructure-tests',
            'test/RiTaEvent-tests',
            'test/RiString-tests',
            'test/RiTa-tests',
            //'test/RiGrammar-tests',
            // TODO: figure out why this one test fails
            'test/RiMarkov-tests',
            'test/RiLexicon-tests'
        ];

        if (argv.name) {

            tests = [testDir + argv.name + '-tests'];
            console.log('[INFO] Testing ' + tests[0]);
        }

        testrunner.setup({
                maxBlockDuration: 20000,
                log: {
                    globalSummary: true,
                    errors: true
                }
            });

        testrunner.run({
                code: "lib/rita.js",
                deps: [
github fyodorvi / jspm-watch / test-project / Gulpfile.js View on Github external
gulp.task('component', function () {
    var cap = function (val) {
        return val.charAt(0).toUpperCase() + val.slice(1);
    };

    var name = yargs.name;
    var parentPath = yargs.parent || '';
    var destPath = path.join(resolveToComponents(), parentPath, name);

    return gulp.src(paths.blankTemplates)
        .pipe(template({
            name: name,
            upCaseName: cap(name)
        }))
        .pipe(rename(function (path) {
            path.basename = path.basename.replace('temp', name);
        }))
        .pipe(gulp.dest(destPath));
});
github Sunbird-Ed / SunbirdEd-portal / src / gulp / theme.js View on Github external
gulp.task('build-theme', function (cb) {
  if (Object.keys(argv).indexOf('name') !== -1) {
    if (typeof argv.name !== 'string') {
      console.error('please enter the theme name')
    }
    if (!fs.existsSync(paths.build_themes.themes + '/' + argv.name + '/' + 'theme.config')) {
      console.error('theme.config not found, add your theme.config in sementic/src/themes/' + argv.name)
    } else {
      generateThemesTasks([{ name: argv.name, path: paths.build_themes.themes + '/' + argv.name }])
      runSequence('build-theme-' + argv.name, cb)
    }
  }

  if (Object.keys(argv).indexOf('create') !== -1) {
    if (typeof argv.create !== 'string') {
      console.error('please enter the theme name')
    } else {
      runSequence('create-theme', cb)
    }
  }

  if (Object.keys(argv).indexOf('watch') !== -1) {
    if (typeof argv.watch !== 'string') {
github trufflesuite / truffle / truffle.es6 View on Github external
registerTask('create:test', "Create a basic test", function(done) {
  var config = Config.gather(truffle_dir, working_dir, argv);

  var name = argv.name;

  if (name == null && argv._.length > 1) {
    name = argv._[1];
  }

  if (name == null) {
    throw new ConfigurationError("Please specify a name. Example: truffle create:test MyTest");
  } else {
    Create.test(config, name, done);
  }
});
github Sunbird-Ed / SunbirdEd-portal / src / gulp / theme.js View on Github external
gulp.task('build-theme', function (cb) {
  if (Object.keys(argv).indexOf('name') !== -1) {
    if (typeof argv.name !== 'string') {
      console.error('please enter the theme name')
    }
    if (!fs.existsSync(paths.build_themes.themes + '/' + argv.name + '/' + 'theme.config')) {
      console.error('theme.config not found, add your theme.config in sementic/src/themes/' + argv.name)
    } else {
      generateThemesTasks([{ name: argv.name, path: paths.build_themes.themes + '/' + argv.name }])
      runSequence('build-theme-' + argv.name, cb)
    }
  }

  if (Object.keys(argv).indexOf('create') !== -1) {
    if (typeof argv.create !== 'string') {
      console.error('please enter the theme name')
    } else {
      runSequence('create-theme', cb)
    }
  }

  if (Object.keys(argv).indexOf('watch') !== -1) {
github MortenHoustonLudvigsen / KarmaTestAdapter / KarmaTestAdapter / KarmaTestServer / Start.js View on Github external
singleRun: argv.singleRun === 'true',
        autoWatch: true,
        loggers: GlobalLog.appenders
    });
    var karmaConfig = Karma.karma.Config.parseConfig(karmaConfigFile, config);
    karmaConfig.plugins.push(require('./Index'));
    karmaConfig.frameworks = karmaConfig.frameworks.map(function (framework) {
        switch (framework) {
            case 'jasmine':
                return 'vs-jasmine';
            default:
                return framework;
        }
    });
    karmaConfig.vs = {
        name: argv.name,
        traits: settings.Traits,
        extensions: settings.Extensions
    };
    freePort().then(function (port) {
        karmaConfig.port = port;
    }).then(function () {
        return freePort(karmaConfig.port + 1).then(function (p) { return karmaConfig.vs.serverPort = p; });
    }).then(function () {
        Karma.karma.Server.start(karmaConfig, function (exitCode) {
            GlobalLog.info('exitCode: ' + exitCode);
            process.exit(exitCode);
        });
    });
}
catch (e) {
    GlobalLog.info(e);
github Oletus / gameutils.js / tools / game-from-template.js View on Github external
var copyTemplateIndex = function(gameDir, templateName) {
    fse.ensureDirSync(path.join(gameDir, 'src'));
    var htmlContents = fs.readFileSync(path.join(rootDir, templateName));
    htmlContents = putInlineJSToFile(htmlContents, path.join(gameDir, 'index.html'), path.join(gameDir, 'src/game.js'));
};

var copySrcToGame = function() {
    fse.copy(path.join(rootDir, 'src'), path.join(gameDir, 'src'), function(err) {
        if (err) {
            return console.error(err);
        }
    });
};

if (checkValidGameName(argv.name)) {
    var gameDir = path.join(rootDir, argv.name);
    createTemplateDirs(gameDir);
    copySrcToGame(gameDir);
    copyPackageJSON(gameDir, argv.name);
    copyUsefulExampleAssets(gameDir);
    copyTemplateFiles(gameDir);
    
    var useThreeJS = (argv.template !== undefined && argv.template === 'threejs');
    if (useThreeJS) {
        copyTemplateIndex(gameDir, 'game-threejs-template.html');
    } else {
        copyTemplateIndex(gameDir, 'game-template.html');
    }
}
github DataFire / OneDB / apps / data-explorer / scripts / new-component.js View on Github external
return `
h1 ${name}
  `.trim();
}

const APP_DIR = __dirname + '/../src/app/';

const filename = args.name.toLowerCase().replace(/\s/g, '-');
const componentName = args.name.replace(/\s/g, '');
const componentDir = APP_DIR + filename + '/';
const componentFile = componentDir + filename + '.component.ts';
const viewFile = componentDir + filename + '.pug';
const appFile = APP_DIR + 'app.module.ts';

let component = componentCode(componentName, filename);
let view = viewCode(args.name);

fs.mkdirSync(componentDir);
fs.writeFileSync(viewFile, view);
fs.writeFileSync(componentFile, component);

let app = fs.readFileSync(appFile, 'utf8');
let lines = app.split('\n').reverse();

let insertImportAt = lines.findIndex(l => l.match(/^import .* from '\.\/.*.component'/));
lines.splice(insertImportAt, 0, `import {${componentName}Component} from './${filename}/${filename}.component'`);

let insertDeclarationAt = lines.findIndex(l => l.match(/^\s+\w+Component,/));
lines.splice(insertDeclarationAt, 0, `    ${componentName}Component,`)

lines.reverse();
fs.writeFileSync(appFile, lines.join('\n'));
github abhiomkar / angular-es6 / Gulpfile.js View on Github external
gulp.task('component', function(){
	var cap = function(val){
		return val.charAt(0).toUpperCase() + val.slice(1);
	};

	var name = yargs.name;
	var parentPath = yargs.parent || '';
	var destPath = path.join(resolveToComponents(), parentPath, name);

	return gulp.src(paths.blankTemplates)
		.pipe(template({
			name: name,
			upCaseName: cap(name)
		}))
		.pipe(rename(function(path){
			path.basename = path.basename.replace('temp', name);
		}))
		.pipe(gulp.dest(destPath));
});
github princejwesley / Mancy / gulpfile.babel.js View on Github external
let cb = (resolve, reject) => {
    api.releases.createRelease({
      owner: owner,
      repo: repo,
      tag_name: `v${Config.version}`,
      body: argv.desc || '',
      name: argv.name || `v${Config.version}`,
      draft: argv.draft === 'yes'
    }, (err, result) => {
      if(err) {
        onError(err);
        return reject(err);
      }
      resolve(result);
    });
  };
  return new Promise(cb);