Demand option of nested config file parameters is not working
See original GitHub issueThe following example will always fail, if the parameter --foo.bar
is not passed through a config file:
const args = require("yargs")
.config("c")
.options("foo.bar", {
demandOption: true,
})
.argv;
console.log(args);
config.json:
{
"foo": {
"bar": "asdf"
}
}
If demandOption
is not set, the output is, as expected { _: [], c: 'config.json', foo: { bar: 'asdf' }, '$0': 'index.js' }
.
If it is set the following error is returned:
Missing required argument: foo.bar
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Alamofire POST request with nested parameters returns ...
It is working with parameters that are not included any nested parameter. Normally, my url is working with following on the Google Chrome....
Read more >Painless Configuration — Confuse 1.7.0 documentation
Environment Variables Nested config values can be overridden by using a separator string in the environment variable name. By default, double underscores are ......
Read more >How to handle large number of configuration parameters ...
I'm open for any suggestion or examples of a particular implementation. At the moment I'm experimenting with nested config variables, each ...
Read more >Java agent configuration: Config file
New Relic's Java agent config settings for APM, including transaction tracer, errors, custom instrumentation, distributed tracing, system properties, etc.
Read more >GitLab CI/CD include examples
Nested includes can include the same configuration file. ... the pipeline is created, so the following pipeline predefined variables are not available:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JoshMcCullough oh no worries, I didn’t take it as such.
I’ve just been dragging my feet on changes to object syntax, because I know if it was done on in a one off, feature by feature, implementation, we’d spend the next 5 years finding parts of the parser where we’d missed supporting it.
Need to figure out some sort of pre-processing step that hits everything at once.
Gotcha. My use of yargs is very limited, so I didn’t mean to trivialize this issue/fix, though I already realize that I did. 😃