How to use the argv function from process

Find comprehensive JavaScript process.argv code examples handpicked from public code repositorys.

43
44
45
46
47
48
49
50
51
52
    `Incorrect SENTRYCLI_LOG_STREAM env variable. Possible values: 'stdout' | 'stderr'`
  );
}

function shouldRenderProgressBar() {
  const silentFlag = process.argv.some((v) => v === '--silent');
  const silentConfig = process.env.npm_config_loglevel === 'silent';
  const silentEnv = process.env.SENTRYCLI_NO_PROGRESS_BAR;
  const ciEnv = process.env.CI === 'true' || process.env.CI === '1';
  const notTTY = !process.stdout.isTTY;
fork icon219
star icon808
watch icon60

34
35
36
37
38
39
40
});
electron.ipcMain.handle(PROCESS_UTILS_FLUSH_STORAGE_DATA, async _ => {
  electron.session.defaultSession.flushStorageData();
});
electron.ipcMain.on(PROCESS_UTILS_GET_MAIN_ARGV_SYNC, event => {
  event.returnValue = process.argv;
});
fork icon143
star icon772
watch icon19

17
18
19
20
21
22
23
24
25
26

const chalk = require('chalk');

const node = process.execPath;
// Array of args passed to idt.js.
const args = process.argv.slice(2);
let win = (process.platform === 'win32');

// Either install idt or run idt + args.
if (args.includes('install')) {
fork icon129
star icon138
watch icon23

4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
  (0, import_process.exit)(1);
}
async function start() {
  const hasStdin = !process.stdin.isTTY;
  const { inputFiles, options, unknownArgs } = argsToOptions(
    import_process.argv.slice(2).join(" "),
    hasStdin
  );
  if (unknownArgs.length > 0) {
    const plural = unknownArgs.length > 1 ? "s" : "";
fork icon45
star icon556
watch icon7

105
106
107
108
109
110
111
112
113
114
  windowSpec.icon = iconPath
}

// Get "testnet" setting
ipcMain.handle('testnet-mode', async () => {
  for (let i = 0; i < process.argv.length; i++) {
    if (process.argv[i].includes('testnet')) {
      return true
    }
  }
fork icon10
star icon83
watch icon6

+ 3 other calls in file

-2
fork icon31
star icon64
watch icon6

20
21
22
23
24
25
26
27
28

// Check command line arguments
lc = `--${lc}:`;
uc = `--${uc}:`;
let rc = null;
process.argv.forEach((arg) => {
        if (arg.startsWith(lc)) rc = arg.split(lc)[1];
        if (arg.startsWith(uc)) rc = arg.split(uc)[1];
});
fork icon1
star icon11
watch icon9

7
8
9
10
11
12
13
14
15
16
const { generateSmarterEncryptionRuleset } = require('./lib/smarterEncryption')
const { generateTdsRuleset } = require('./lib/tds')
const { generateExtensionConfigurationRuleset } =
      require('./lib/extensionConfiguration')

const [command, ...args] = process.argv.slice(2)

async function main () {
    switch (command) {
    case 'smarter-encryption':
fork icon200
star icon0
watch icon94

+ 3 other calls in file

81
82
83
84
85
86
87
88
89
90
    case 'reset': { command = reset; } break;

    default: { throw new Error(`Unknown command '${process.argv[2]}'`); } break;
}

for (let i = 3; i < process.argv.length; i++) {
    let arg = process.argv[i];
    let value = null;

    if (arg[0] == '-') {
fork icon7
star icon35
watch icon0

6
7
8
9
10
11
12
13
14
15
16
17
utils.print = function() {}; // overwriting the print function to avoid the print


async function runAllTests() {
    const files = [];
    const x = new Assert();
    x.blessEnabled = process.argv.findIndex(arg => arg === '--bless') !== -1;


    x.startTestSuite('all', false);
    print('> Starting all tests...');
    print('');
fork icon2
star icon8
watch icon1

1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
const { patchup: patchUp } = require('dcp/dcp-url');
const { Address } = require('dcp/wallet');
const custom = new kvin.KVIN();
custom.userCtors.dcpEth$$Address = Address;

const spawnArgv = [require.resolve('./bin/build-dcp-config'), process.argv.slice(2)];
/* XXX @todo - in debug build,  spawnArgv.unshift('--inspect'); */
const env = process.env.DEBUG ? Object.assign({}, process.env) : process.env;
delete env.DEBUG;
const child = spawnSync(
fork icon1
star icon5
watch icon4

3
4
5
6
7
8
9
10
11
12
13
14
const buffer = fs.readFileSync(process.argv[2]);


let m = new WebAssembly.Module(buffer);
let list = WebAssembly.Module.imports(m);
console.log('imports', list);
if (list.length !== process.argv.length - 3)
  throw new Error("wrong number of imports")


const imports = new Map();
for (let i = 3; i < process.argv.length; i++) {
fork icon0
star icon2
watch icon3

-3
fork icon0
star icon0
watch icon1

+ 2 other calls in file

9
10
11
12
13
14
15
16
17
18
19
20


class Main {


  constructor() {
    this.processType = undefined;
    this.argv  = process.argv;
    this.apply = false;
    this.verbose = false;
    this.repoPaths = this.getRepoPaths();
    this.repoRootDir = this.pwd();
fork icon0
star icon0
watch icon1

+ 3 other calls in file

7
8
9
10
11
12
13
14
15
16
17
18
 * development with webpack-dev-server.
 */
const devServerProxyTarget
    = process.env.WEBPACK_DEV_SERVER_PROXY_TARGET || 'https://alpha.jitsi.net';


const analyzeBundle = process.argv.indexOf('--analyze-bundle') !== -1;


const minimize
    = process.argv.indexOf('-p') !== -1
        || process.argv.indexOf('--optimize-minimize') !== -1;
fork icon0
star icon0
watch icon1

+ 2 other calls in file

32
33
34
35
36
37
38
39
40
41
42
    firstFileArgumentIndex = 3
}


for (const optimize of [false, true])
{
    for (const filename of process.argv.slice(firstFileArgumentIndex))
    {
        if (filename !== undefined)
        {
            let input = {
fork icon0
star icon0
watch icon1

+ 3 other calls in file

825
826
827
828
829
830
831
832
833
834
if (argv !== undefined && !Array.isArray(argv)) {
  throw new Error('first parameter to parse must be array or undefined');
}
parseOptions = parseOptions || {};

// Default to using process.argv
if (argv === undefined) {
  argv = process.argv;
  // @ts-ignore: unknown property
  if (process.versions && process.versions.electron) {
fork icon0
star icon0
watch icon1

+ 5 other calls in file

254
255
256
257
258
259
260
261
262
263
264
265
  return this.nullTo(s, def).toString();
};




_nx.getProcessOption = function (opt) {
  for (let i = 0; i < process.argv.length; ++i) {
    if (process.argv[i] === opt)
      return i;
  }
  return -1;
fork icon0
star icon0
watch icon1