How to use the _ function from yargs

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

42
43
44
45
46
47
48
49
50
51
    return command === 'ls' || command === 'decode' || command === 'encode';
  })
  .argv;

var command = argv._.shift(),
  files = argv._;

switch(command) {
  case 'ls':
    ls(files, argv);
fork icon21
star icon363
watch icon19

+ 7 other calls in file

38
39
40
41
42
43
44
45
46
47
var fail = 0;
var failures = [];

var genStack = [];

var pathspec = argv._.length>0 ? argv._[0] : '../openapi-directory/APIs/';

var options = argv;
var widdershinsOptions = {};
widdershinsOptions.sample = true;
fork icon55
star icon304
watch icon220

+ 3 other calls in file

30
31
32
33
34
35
36
37
38
39

var base = path.normalize(path.join(path.dirname(require.resolve('../lib/index.js')), '..'));

child_process.execFileSync('make', [
  'enclave',
  'SCRIPTS=' + argv._.map(function (script) {return path.resolve(script);}).join(' '),
  'ENCLAVE_KEY=' + path.resolve(argv.key),
  'ENCLAVE_CONFIG=' + path.resolve(argv.config),
  'ENCLAVE_OUTPUT=' + path.resolve(argv.output)
], {
fork icon17
star icon96
watch icon20

+ 5 other calls in file

84
85
86
87
88
89
90
91
axios.get('https://api.ipify.org')
.then(res => {
  externalIP = res.data;
}).then(() => {
  console.log("External IP: " + externalIP);
  argv._.forEach(url => bc.queue(url));
  bc.start();
});
fork icon18
star icon33
watch icon0

9
10
11
12
13
14
15
16
17
18
const log = new Log({logLevelConsole: 'debug', logName: 'yaml2json'});
const path = require('path');
const yaml = require('yaml');

// Get file args
const inputFiles = argv._;
// Get options
const outputDir = path.resolve(argv.outputDir || process.cwd());

// If no files then print some basic usage shit
fork icon35
star icon30
watch icon4

136
137
138
139
140
141
142
143
144
145
    }
}

process.exitCode = 1;
if ((!argv._.length) && (!argv.fail)) {
    argv._.push('.');
}
for (var pathspec of argv._) {
    processPathSpec(pathspec, false);
}
fork icon17
star icon27
watch icon4

19
20
21
22
23
24
25
26
27
28
    describe: 'Log about the process',
  })
  .demandCommand(3)
  .argv;

const [idsPath, inPath, outPath] = argv._;

function log(message) {
  if (argv.verbose) {
    console.log(message);
fork icon10
star icon16
watch icon0

+ 3 other calls in file

32
33
34
35
36
37
38
39
40
41
const inputs = lodash.assign({}, DEFAULTS, argv);
delete inputs._;
delete inputs.$0;

// List of arguments following the command
const args = argv._;

const branch = cp.execSync('git symbolic-ref --short -q HEAD || git rev-parse --short HEAD').toString().trim();
log.log(`fyi, your current branch is ${JSON.stringify(branch)}\n`);
if (!inputs.branch) {
fork icon132
star icon0
watch icon43

+ 17 other calls in file

32
33
34
35
36
37
38
39
  .version(function () {
    return require('../package.json').version;
  })
  .argv;

args.entry = args._.pop();

bundler(args);
fork icon4
star icon2
watch icon8

70
71
72
73
74
75
76
77
78
79

if (encodings.indexOf(argv['from-code']) < 0) {
  throw new Error(`${pkg.name}: encoding of input files must be either utf8, ascii or base64`);
}

if (!argv['files-from'] && argv._.length === 0) {
  return pkg.name + ': no input file given';
}

return true;
fork icon35
star icon79
watch icon7

+ 5 other calls in file

57
58
59
60
61
62
63
64
65
66
if (argv.testargs) {
  console.log(argv)
  process.exit()
}

var uri = argv._.shift()
if (!/^[^\/]*\:\/\//.test(uri)) {
  if (/mbtiles$/.test(uri)) {
    uri = 'mbtiles://' + path.resolve(uri)
  } else if (!process.env.MapboxAccessToken) {
fork icon13
star icon60
watch icon56

28
29
30
31
32
33
34
35
36
const uglify = require('gulp-uglify');
const watchify = require('watchify');

const production = !!argv.production;

const build = argv._.length ? argv._[0] === 'build' : false;
const watch = argv._.length ? argv._[0] === 'watch' : true;

const reload = browserSync.reload;
fork icon0
star icon0
watch icon1

+ 5 other calls in file

Other functions in yargs

Sorted by popularity

function icon

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