New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkgConf
has no effect after the first usage
#2191
Comments
You could make a new yargs instance for every parse. const Yargs = require('yargs/yargs');
const opts1 = Yargs([]).pkgConf('test', 'a').parse();
const opts2 = Yargs([]).pkgConf('test', 'b').parse(); [Edit: changed "should make" to "could make".] |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I misunderstood that Yargs does mostly make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yargs v17.5.1
Currently,
pkgConf
only loads package.json options when it is called for the first time. All other usages are silently ignored. This makes it impossible to reuse the same instance of Yargs when thecwd
or thekey
value changes.In the example above,
opts2
andopts3
always end up getting the same values asopts1
, because only the first usage ofpkgConf
has an effect.It would be helpful if those repeated usages would produce an error telling the user that they are doing something wrong, or even better, if using
pkgConf
multiple times was allowed.The text was updated successfully, but these errors were encountered: