Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not set boolean flags if not defined in
argv
(#119)
BREAKING CHANGE: `boolean` flags defined without a `default` value will now behave like other option type and won't be set in the parsed results when the user doesn't set the corresponding CLI arg. Previous behavior: ```js var parse = require('yargs-parser'); parse('--flag', {boolean: ['flag']}); // => { _: [], flag: true } parse('--no-flag', {boolean: ['flag']}); // => { _: [], flag: false } parse('', {boolean: ['flag']}); // => { _: [], flag: false } ``` New behavior: ```js var parse = require('yargs-parser'); parse('--flag', {boolean: ['flag']}); // => { _: [], flag: true } parse('--no-flag', {boolean: ['flag']}); // => { _: [], flag: false } parse('', {boolean: ['flag']}); // => { _: [] } => flag not set similarly to other option type ```
- Loading branch information