Using an equal sign with short/alias options and an empty string
Open
Nobody has claimed this yet.
bug
- Dominant language
- JavaScript
- Stars
- 519
- Forks
- 129
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
Short options do not seem to work when using an equal sign and an empty string.
Example:
// yargs.js
const yargs = require('yargs')
console.log(yargs.option('opt', { alias: 'o' }).parse())
$ node yargs.js -o ""
{ _: [], o: '', opt: '', '$0': 'yargs.js' }
$ node yargs.js -o=""
{ _: [], o: true, opt: true, '=': true, '$0': 'yargs.js' }
Note that this works correctly when not using an empty string:
$ node yargs.js -o "value"
{ _: [], o: 'value', opt: 'value', '$0': 'yargs.js' }
$ node yargs.js -o="value"
{ _: [], o: 'value', opt: 'value', '$0': 'yargs.js' }
Using yargs 16.2.0 on Node 15.6.0.
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 reproducing the two command-line forms in the reported yargs.js example, comparing -o "" with -o="" and the resulting alias values. Done means the equals-sign form preserves the empty string for both o and opt and does not add an unexpected '=' key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100