Skip to content

Commit

Permalink
add checkConfiguration()
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Oct 28, 2019
1 parent 212814f commit 4c9af21
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.js
Expand Up @@ -131,6 +131,8 @@ function parse (args, opts) {
})
})

checkConfiguration()

var argv = { _: [] }
var notFlags = []

Expand Down Expand Up @@ -874,6 +876,20 @@ function parse (args, opts) {
return num === undefined
}

// check user configuration settings for inconsistencies
function checkConfiguration () {
// count keys should not be set as array/narg
Object.keys(flags.counts).find(key => {
if (checkAllAliases(key, flags.arrays)) {
error = Error(__('Invalid configuration: %s is set as count and array', key))
return true
} else if (checkAllAliases(key, flags.nargs)) {
error = Error(__('Invalid configuration: %s is set as count and narg', key))
return true
}
})
}

return {
argv: argv,
error: error,
Expand Down

0 comments on commit 4c9af21

Please sign in to comment.