Skip to content

Commit

Permalink
patch: includes aliases when looking for defaults for booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Mar 18, 2023
1 parent 093bc85 commit cc5ec96
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,15 @@ module.exports = function (args, opts) {
});
}

// Set booleans to false by default.
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
setArg(key, false);
});
// Overwrite booleans with user supplied defaults.
Object.keys(defaults).filter(function (key) {
return flags.bools[key] || (aliases[key] ? aliasIsBoolean(key) : false);
}).forEach(function (key) {
setArg(key, defaults[key]);
});

var notFlags = [];
Expand Down

0 comments on commit cc5ec96

Please sign in to comment.