nconf icon indicating copy to clipboard operation
nconf copied to clipboard

Unable to call argv.showHelp to show argv usage

Open Telokis opened this issue 8 years ago • 4 comments

I am trying to call argv.showHelp in order to display which arguments are available to the user.

However, if I do nconf.argv().showHelp(); it crashes.

I tried reading the source code and I really expect this to work but it won't.

Telokis avatar Oct 12 '17 13:10 Telokis

nconf.argv() returns an instance of nconf so you can chain calls together.

You can access the help via nconf.argv().stores.argv.showHelp(); however, this is designed to be handled by a formatter, so the results may not be terribly useful to you.

mhamann avatar Oct 12 '17 14:10 mhamann

Could it be possible for nconf to accept an optional usage argument/option to be passed to yargs so that yargs can automatically handle --help?

Telokis avatar Oct 12 '17 14:10 Telokis

@Telokis sounds like that could be a good enhancement. Why not take a look at the source and submit a PR?

mhamann avatar Oct 22 '17 03:10 mhamann