Skip to content

Commit

Permalink
Allow overriding boolean config values again. #12
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 11, 2021
1 parent 1cd96fe commit 1da0c43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ let verbose = false;
let schemaMap = {};
let schemaFolder = null;

let booleanArgs = ['verbose', 'ignoreCerts', 'lint', 'format', 'version'];

async function run(config) {
try {
let args = config || minimist(process.argv.slice(2));
Expand Down Expand Up @@ -60,6 +62,14 @@ async function run(config) {
if (key === '_' && Array.isArray(value) && value.length > 0) {
config.files = value;
}
else if (booleanArgs.includes(key)) {
if (typeof value === 'string' && value.toLowerCase() === 'false') {
config[key] = false;
}
else {
config[key] = Boolean(value);
}
}
else {
config[key] = value;
}
Expand Down

0 comments on commit 1da0c43

Please sign in to comment.