You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In any case, I went and wrote a little CLI tool using nodejs and yargs and in particular its .config() mechanism; so far, so good. However, if I pass --config more than once (e.g. --config a.json --config b.json), it dies with the help message and the confusing report Invalid JSON config file: [ './a.json', './b.json' ]. A little brute force shows that that report arises from
) and path.resolve balks if not given a string as its second argument.
At the very least the error could be more informative (perhaps, "configuration options may be given at most once"), but because it's possible to have multiple .config() directives applied to yargs, and so the machinery tolerates the notion of multiple config files in general, I would prefer to wrap the entirety of
I am unsure if this belongs here or over in https://github.com/yargs/yargs instead, but I think it's mostly an issue here in the parser.
In any case, I went and wrote a little CLI tool using
nodejs
andyargs
and in particular its.config()
mechanism; so far, so good. However, if I pass--config
more than once (e.g.--config a.json --config b.json
), it dies with the help message and the confusing reportInvalid JSON config file: [ './a.json', './b.json' ]
. A little brute force shows that that report arises fromyargs-parser/lib/yargs-parser.ts
Line 688 in 217aa62
mixin.resolve
onyargs-parser/lib/yargs-parser.ts
Line 666 in 217aa62
path.resolve
(owing toyargs-parser/lib/index.ts
Line 38 in 90f970a
path.resolve
balks if not given a string as its second argument.At the very least the error could be more informative (perhaps, "configuration options may be given at most once"), but because it's possible to have multiple
.config()
directives applied toyargs
, and so the machinery tolerates the notion of multiple config files in general, I would prefer to wrap the entirety ofyargs-parser/lib/yargs-parser.ts
Lines 664 to 689 in 217aa62
configPath
is an array.The text was updated successfully, but these errors were encountered: