Tabnine Logo For Javascript
yargs
Code IndexAdd Tabnine to your IDE (free)

How to use yargs

Best JavaScript code snippets using yargs(Showing top 15 results out of 1,368)

origin: standard-things/esm

Promise
 .all([
  argv.prod && cleanJS(),
  setupRepo(),
  setupNode(),
  setupTest262()
 ])
 .then(() => runTests())
 .then(() => runTests(true))
origin: lando/lando

/**
  * 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;
 }
origin: laurent22/joplin

async function main() {
  const argv = require('yargs').argv;

  process.chdir(appDir);

  console.info(`Running from: ${process.cwd()}`);

  const version = (await execCommand('npm version patch')).trim();
  const tagName = version;

  console.info(`New version number: ${version}`);

  console.info(await execCommand('git add -A'));
  console.info(await execCommand(`git commit -m "Electron release ${version}"`));
  console.info(await execCommand(`git tag ${tagName}`));
  console.info(await execCommand('git push && git push --tags'));

  const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };

  console.info('Release options: ', releaseOptions);

  const release = await githubRelease('joplin', tagName, releaseOptions);

  console.info(`Created GitHub release: ${release.html_url}`);
  console.info('GitHub release page: https://github.com/laurent22/joplin/releases');
  console.info(`To create changelog: node Tools/git-changelog.js ${version}`);
}
origin: laurent22/joplin

async function main() {
  const argv = require('yargs').argv;
  if (!argv._.length) throw new Error('Tag name must be specified. Provide the tag of the new version and git-changelog will walk backward to find the changes to the previous relevant tag.');
  const fromTagName = argv._[0];
  let toTagName = argv._.length >= 2 ? argv._[1] : '';
origin: princejwesley/Mancy

const processParamHandler = (browser) => {
 const theme = argv.t || argv.theme;
 if(theme && themes[theme]) {
  browser.webContents.send(themes[theme]);
 const lang = argv.l || argv.lang;
 if(lang && langs[lang]) {
  browser.webContents.send('application:prompt-language', langs[lang]);
 const mode = argv.m || argv.mode;
 if(mode && modes[mode]) {
  browser.webContents.send('application:prompt-mode', modes[mode]);
 const editor = argv.e || argv.editor;
 if(editor && editors[editor]) {
  browser.webContents.send('application:editor-mode', editors[editor]);
 const script = argv.s || argv.script;
 if(script) {
  browser.webContents.send('application:load-file', script);
 const session = argv.i || argv.import || argv.session;
 if(session) {
  browser.webContents.send('application:import-file', session);
 const p = argv.p || argv.path;
 if(p) {
  browser.webContents.send('application:add-path', p.split(path.delimiter));
origin: lando/lando

yargonaut.style('green').errorsStyle('red');
const yargs = require('yargs');
const {clear, channel, experimental, secretToggle} = yargs.argv;
origin: laurent22/joplin

async function main() {
  const argv = require('yargs').argv;
  const isPreRelease = !!argv.prerelease;
origin: sx1989827/DOClever

  createDir(path.join(con.filePath,"temp"));
if(argv.db)
  con.db=argv.db;
if(argv.file)
    createDir(argv.file)
    process.exit(0);
  con.filePath=argv.file;
if(argv.port)
  con.port=parseInt(argv.port);
origin: ruyadorno/ntl

function error(e, msg) {
  out.error(argv.debug ? e : msg);
  process.exit(1);
}
origin: express-vue/express-vue

.command("build [configPath]", "Build project", (yarg) => {
  return yarg
    .positional("configPath", {
      type: "string",
      default: process.cwd(),
      describe: "The path where expressvue.config.js lives",
    })
    .coerce("configPath", (arg) => {
      return path.join(process.cwd(), arg);
    })
    .option("verbose", {
      alias: "v",
      default: false,
.help()
origin: ruyadorno/ntl

const hasDescriptions =
  descriptionsKeys.length > 0 && descriptionsKeys.some(key => scripts[key]);
const shouldWarnNoDescriptions = argv.descriptions && !hasDescriptions;
if (shouldWarnNoDescriptions) {
  out.warn(`No descriptions for your ${runner} scripts found`);
  .map(key => ({
    name:
      argv.info || argv.descriptions
        ? getLongName(
            key,
            argv.descriptions && descriptions[key]
              ? descriptions[key]
              : scripts[key]
      argv.all
        ? true
        : ["pre", "post"].every(prefix => !item.value.startsWith(prefix))
    item => (argv.descriptionsOnly ? descriptions[item.value] : true)
      !argv.exclude ||
      !argv.exclude.some(e =>
        new RegExp(e + (e.includes("*") ? "" : "$"), "i").test(item.value)
origin: firebase/quickstart-nodejs

.usage('$0 <cmd> [args]')
.command('new <model_file> <name> [-t tags]]',
     'Upload and publish a tflite model',
     (yargs) => {
      yargs.positional('model_file', {
       describe: 'Path to a tflite model',
       type: 'string'
      });
      yargs.positional('name', {
       describe: 'Display name for the model',
       type: 'string'
      });
      yargs.option('tags', {
       alias: 't',
       demandOption: false,
     }, (argv) => {
      (async () => {
       const tags = argv.tags == null ? null : argv.tags.split(',');
       await uploadModel(argv.model_file, argv.name, tags);
       process.exit();
      })().catch(e => {
      });
     })
.command('list [-f filter-exp]',
     'List the models in your project.\n\nFor information about the '
     + 'filter language, see\n'
     + 'https://firebase.google.com/docs/ml-kit/manage-hosted-models#list_your_projects_models',
origin: maxpert/raspchat

gulp.task('compile-js', function () {
  return gulp.src(Settings.js.source + '/' + Settings.js.sourceFile)
    .pipe(browserify({
      insertGlobals : true,
      debug : !argv.p
    }))
    .pipe(rename(Settings.js.outputFile))
    .pipe(gulp.dest(Settings.js.static));
});
origin: Mermade/openapi-codegen

function finishLocal(err,result) {
  if (argv.zip) {
    // create archive
    var zip = new admzip();

    // add files directly
    for (let f in zipFiles) {
      zip.addFile(f, new Buffer(zipFiles[f]), 'Created with OpenAPI-CodeGen');
    }
    // write everything to disk
    zip.writeZip(path.join(config.outputDir,configName+'.zip'));
  }
}
origin: firebase/quickstart-nodejs

.usage('$0 <cmd> [args]')
.command('new <model_file> <name> [-t tags]]',
     'Upload and publish a tflite model',
     (yargs) => {
      yargs.positional('model_file', {
       describe: 'Path to a tflite model',
       type: 'string'
      });
      yargs.positional('name', {
       describe: 'Display name for the model',
       type: 'string'
      });
      yargs.option('tags', {
       alias: 't',
       demandOption: false,
     }, (argv) => {
      (async () => {
       const tags = argv.tags == null ? null : argv.tags.split(',');
       await uploadModel(argv.model_file, argv.name, tags);
       process.exit();
      })().catch(e => {
      });
     })
.command('list [-f filter-exp]',
     'List the models in your project.\n\nFor information about the '
     + 'filter language, see\n'
     + 'https://firebase.google.com/docs/ml-kit/manage-hosted-models#list_your_projects_models',
yargs(npm)

JSDoc

yargs the modern, pirate-themed, successor to optimist.

Most used yargs functions

  • Argv.command
    Define the commands exposed by your application.
  • Argv.help
    Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the proce
  • Argv.option
    This method can be used to make yargs aware of options that could exist.
  • Argv.wrap
    Format usage output to wrap at columns many columns.
  • Argv.strict
    Any command-line argument given that is not demanded, or does not have a corresponding description,
  • Argv.example,
  • Argv.recommendCommands,
  • Argv.version,
  • Argv.usage,
  • Argv.alias,
  • Argv.options,
  • Argv.argv,
  • Argv.parse,
  • Argv.check,
  • Argv.positional,
  • _,
  • Argv.demandCommand,
  • debug,
  • Argv.default

Popular in JavaScript

  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • request
    Simplified HTTP request client.
  • winston
    A logger for just about everything.
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • postcss
  • path
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • body-parser
    Node.js body parsing middleware
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now