Implies always fails when the value key is a nested value
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Take the following Yargs code/configuration:
import * as yargs from 'yargs';
const argv = yargs
.option('calibration', {
type: 'boolean'
})
.options('orientation.calibration', {
describe: 'What Interface Orientation was calibration locked to',
choices: ['left', 'right']
})
.implies('calibration', 'orientation.calibration')
.argv
The following script call should work, but fails.
$ ./run.js --calibration --orientation.calibration "left"
Options:
--orientation.calibration What Interface Orientation was calibration locked
to [choices: "left", "right"]
Implications failed:
calibration -> orientation.calibration
The error seems to lie in the Validator, specifically validation.implications, as it doesn't check for nested values.
I.E. argv['orientation.calibration'] instead of argv.orientation.calibration
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
Locate the validator code responsible for validation.implications and trace how it checks the implied option values. Reproduce the reported command with a nested option, then verify that the implication succeeds for orientation.calibration while preserving the existing behavior for non-nested values.
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
- Mostly clear
- Newbie friendliness
- 45/100