How to use the config function from yargs

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

24
25
26
27
28
29
30
31
32
33
const packageJson = require(packageJsonPath);

const oneAppRunnerConfig = (packageJson['one-amex'] && packageJson['one-amex'].runner) || {};

if (Object.keys(oneAppRunnerConfig).length > 0) {
  yargs.config(oneAppRunnerConfig);
}

yargs
  .option('module-map-url', {
fork icon28
star icon32
watch icon16

79
80
81
82
83
84
85
86
87

if (argv.env)
    env             = argv.env;

if (argv.config)
    config_file     = argv.config;

if(argv.strict)
    strict          = argv.strict;
fork icon8
star icon10
watch icon8

45
46
47
48
49
50
51
52
53
54
    .describe('p', 'Purge')
    .alias('p', 'purge')
    .boolean('p')
    .argv;

const configPath = argv.config;

const sleep = ms => new Promise((r, j) => {
  setTimeout(r, ms * 1000);
});
fork icon1
star icon0
watch icon4

+ 8 other calls in file

61
62
63
64
65
66
67
68
69
70

        .argv
    ; // node-optimist


var configuration_script = __dirname + "/" + argv.config;
var configuration = redmine_importer.setConfiguration(configuration_script);


function main() {
fork icon0
star icon2
watch icon0

2
3
4
5
6
7
8
9
10
11
const yargs = require('yargs');
const configHelper = require('./src/helpers/config-helper');

configHelper.load()
    .then(config => {
        yargs.config(config);

        return yargs
            .commandDir('src/commands/pull-request')
            .demandCommand()
fork icon0
star icon2
watch icon26

4
5
6
7
8
9
10
11
12
13
14
15
const run = require('./run');


const pkg = require('../../package.json');


module.exports = function () {
  const argv = yargs.config('config').usage('$0 [options] <source>').options({
    port: {
      alias: 'p',
      description: 'Set port',
      default: 3000
fork icon0
star icon0
watch icon0

Other functions in yargs

Sorted by popularity

function icon

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