How to use config and pkgConf to configure subcommands?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
If I have subcommands, how would I go about getting things configured via config file and/or package.json via pkgConf?
For example, let's say I have this:
foo bar --out-file ./bar.txt
foo baz --out-file ./baz.txt
...but now I want to call my subcommands with a single config file (or via package.json) like this:
foo bar --config ./foo.json
foo baz --config ./foo.json
How do I configure the "out-file" option for each subcommand? Won't users run into "namespace" conflicts on my options (i.e. since I can only have one "out-file" key in my config)? How do i specify a separate out-file for both bar and baz without requiring the user to have two different config files (e.g. bar.config and baz.config)? How do I do this with package.json via pkgConf with only a single "foo" key in package.json?
Related issue:
https://github.com/yargs/yargs/issues/464
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing yargs subcommand configuration and the pkgConf/package.json integration described in the issue, then compare the related issue #464. Define how separate out-file values for bar and baz should be represented in one config source, and document or implement the agreed behavior with coverage for both subcommands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100