Unable to combine count with environment variables
Open
Nobody has claimed this yet.
needs investigation
- Dominant language
- JavaScript
- Stars
- 519
- Forks
- 129
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
There can be only one key for each environment variable. This means a counted option can’t be set this way.
I suggest to change the behaviour of count so that environment variables representing the count, can be set as numbers.
E.g. Given the following option
const yargs = require('yargs');
yargs
.option('verbose', {
alias: 'v',
describe: 'Increase verbosity',
type: 'count',
});
VERBOSE=3 ./my-app
would be equivalent to
./my-app -vvv
Contributor guide
No contributing guide indexed for this repository
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 tracing how yargs-parser handles counted options and environment-variable values. Verify that VERBOSE=3 produces the same parsed count as -vvv, and add or update coverage for the example behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100