How to use the help function from yargs

Find comprehensive JavaScript yargs.help code examples handpicked from public code repositorys.

72
73
74
75
76
77
78
79
80
  console.error("Non-existing or no command specified.");
  process.exit(1);
})
yargs.demandCommand(1)

yargs.help('h')
yargs.alias('h', 'help')
yargs.alias('v', 'version')
yargs.env(meta.name.replace(/-/g, '').toUpperCase())
fork icon13
star icon30
watch icon4

65
66
67
68
69
70
71
72
73
74
        });

    }
);
yargs.wrap(yargs.terminalWidth());
yargs.help();
let argv = yargs.argv;

// If verbose, enable logging
if (argv.verbose) {
fork icon18
star icon24
watch icon2

277
278
279
280
281
282
283
284
285
286
var argv = require('yargs/yargs')(process.argv.slice(2))
  .fail(function (msg, err, yargs) {
    if (err) throw err // preserve stack
    console.error('You broke it!')
    console.error(msg)
    console.error('You should be doing', yargs.help())
    process.exit(1)
  })
  .argv
```
fork icon0
star icon0
watch icon78

+ 5 other calls in file

173
174
175
176
177
178
179
180
181
182

var program = module.exports = {
  <METHOD_NAME>: <METHOD_NAME>,
  main: function (args) {
    // Run the command-line program
    cli.help().strict().parse(args).argv; // eslint-disable-line
  }
};

cli
fork icon0
star icon0
watch icon2

+ 7 other calls in file

15
16
17
18
19
20
21
22
23
24
      outputPath: string, interactive: boolean, saveArtifacts: boolean, saveAssets: boolean,
      view: boolean, maxWaitForLoad: number
}

export function getFlags() {
  return yargs.help('help')
      .version(() => pkg.version)
      .showHelpOnFail(false, 'Specify --help for available options')

      .usage('lighthouse <url>')
fork icon0
star icon0
watch icon4

+ 3 other calls in file

Other functions in yargs

Sorted by popularity

function icon

yargs.argv is the most popular function in yargs (1012 examples)