How to use the env function from yargs

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

27
28
29
30
31
32
33
34
35
36
const {getDocJSONPVarNname} = require('./src/shared');

const projectDir = __dirname;

function initEnv() {
    let envType = argv.env;
    let isDev = argv.dev != null || argv.debug != null || argv.env === 'dev';

    if (isDev) {
        console.warn('=============================');
fork icon155
star icon209
watch icon35

38
39
40
41
42
43
44
45
46
47
 * ```
 * ----------------------------------------------------------------------------------
 */

function initEnv() {
    var envType = argv.env;
    var isDev = argv.dev != null || argv.debug != null || envType === 'debug' || envType === 'dev';

    if (isDev) {
        console.warn('====================================================================');
fork icon57
star icon61
watch icon38

+ 3 other calls in file

75
76
77
78
79
80
81
82
83
84
  yargs.demandCommand(1)

  yargs.help('h')
  yargs.alias('h', 'help')
  yargs.alias('v', 'version')
  yargs.env(meta.name.replace(/-/g, '').toUpperCase())

  const argv = yargs.argv

}
fork icon13
star icon30
watch icon4

76
77
78
79
80
81
82
83
84
var manager;
var strict;
var item;

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

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

2
3
4
5
6
7
8
9
10
11
const argv = require('yargs').argv;
const fs = require('fs');
const path = require('path');
const url = require('url');
// 获取运行参数
const env = argv.env;

const ENVS = ['dev', 'qa' ,'pre' ,'prod'];

if (ENVS.indexOf(env) < 0) {
fork icon1
star icon6
watch icon1

77
78
79
80
81
82
83
84
85
86
87
88
/******
 * Unit test setup
 */


var testingFolder ='/Applications/MAMP/htdocs/wordpress_unit_test/wp-content/plugins/leadpages';
var enviroment = args.env;


gulp.task('move_to_test', function(){
    return gulp.src(['**/*'], {"base" : "."})
        .pipe(gulp.dest(testingFolder));
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)