How to use the exit function from yargs

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

89
90
91
92
93
94
95
96
97
            );
            await actor.dismiss();
        }
        catch (error) {
            printer.error(formatError(error));
            yargs.exit(1, error.message);
        }
    },
};
fork icon152
star icon473
watch icon34

+ 5 other calls in file

4
5
6
7
8
9
10
11
12
const fs = require('fs')
const argv = yargs(hideBin(process.argv)).argv

if (!fs.existsSync(argv.i)) {
    console.error('Input folder (-i) must exist.')
    exit(1)
}

const files = fs.readdirSync(argv.i)
fork icon202
star icon0
watch icon95

+ 3 other calls in file

79
80
81
82
83
84
85
86
87
88
console.log(chalk.bold.green('*** Quant deploy ***'));

// Make sure configuration is loaded.
if (!config.fromArgs(argv)) {
  console.log(chalk.yellow('Quant is not configured, run init.'));
  yargs.exit(1);
}

const dir = argv.dir || config.get('dir');
const p = path.resolve(process.cwd(), dir);
fork icon0
star icon2
watch icon3

+ 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)