How to use the config function from commander

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

93
94
95
96
97
98
99
100
101
102

// Setup up logging output
Error.stackTraceLimit = Infinity;
logger.stripColors = program['colors'] === false;
logger.logLevel = program['logLevel'] || logger.TRACE;
if (program.config && program.config.indexOf('logLevel') !== -1) {
        logger.logLevel = -1;
}

if (!program.noBanner && program.args[0] !== 'info' && (program.config && program.config.indexOf('noBanner') === -1)) {
fork icon928
star icon958
watch icon141

+ 3 other calls in file

13
14
15
16
17
18
19
20
21
}

/*Get config from json file*/
var fs = require('fs');

var file = __dirname + "/" + program.config;

fs.readFile(file, 'utf8', function (err, data) {
        if (err)  {console.dir(err); return;}
fork icon2
star icon4
watch icon10

196
197
198
199
200
201
202
203
204
205
let configExplorerResult;

let configFile: ConfigurationFileInterface = {};

if (program.config) {
    let configFilePath = program.config;
    let testConfigFilePath = configFilePath.match(process.cwd());
    if (testConfigFilePath && testConfigFilePath.length > 0) {
        configFilePath = configFilePath.replace(process.cwd() + path.sep, '');
    }
fork icon385
star icon2
watch icon0

75
76
77
78
79
80
81
82
83
84
85
  process.exit(0);
}


if (!!program.config) {
  LoggingManager.system('APP', 'main', 'Using config file: ' + program.config);
  configFile = program.config;
} else {
  LoggingManager.fatal('APP', 'main', 'Error: No config file specified!');
  LoggingManager.fatal('APP', 'main', 'Use --config [file] to specify a config file or --newconfig [file] to create one.');
  process.exit(1);
fork icon0
star icon0
watch icon0

+ 2 other calls in file

Other functions in commander

Sorted by popularity

function icon

commander.Option is the most popular function in commander (1786 examples)