Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docu: update boolean description #1474

Merged
merged 1 commit into from Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions docs/api.md
Expand Up @@ -74,11 +74,7 @@ For example: `--foo foo bar -- val` will be parsed as
<a name="boolean"></a>.boolean(key)
-------------

Interpret `key` as a boolean. If a non-flag option follows `key` in
`process.argv`, that string won't get set as the value of `key`.

`key` will default to `false`, unless a `default(key, undefined)` is
explicitly set.
Interpret `key` as a boolean. If a non-flag option - unless `true` or `false` - follows `key` in `process.argv`, that string won't get set as the value of `key`.

`key` can be set false explicitly using the `--no-` prefix, [more](/docs/tricks.md#negate).

Expand Down
10 changes: 5 additions & 5 deletions docs/examples.md
Expand Up @@ -233,17 +233,17 @@ boolean_single.js:
````javascript
#!/usr/bin/env node
var argv = require('yargs')
.boolean('v')
.boolean(['r','v'])
.argv
;
console.dir(argv.v);
console.dir([ argv.r, argv.v ]);
console.dir(argv._);
````

***

$ ./boolean_single.js -v "me hearties" yo ho
true
$ ./boolean_single.js -r false -v "me hearties" yo ho
[ false, true ]
[ 'me hearties', 'yo', 'ho' ]


Expand All @@ -262,7 +262,7 @@ console.dir(argv._);
***

$ ./boolean_double.js -x -z one two three
[ true, false, true ]
[ true, undefined, true ]
[ 'one', 'two', 'three' ]

Yargs is here to help you...
Expand Down
4 changes: 2 additions & 2 deletions example/boolean_single.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
var argv = require('yargs')
.boolean('v')
.boolean(['r','v'])
.argv
;
console.dir(argv.v);
console.dir([ argv.r, argv.v ]);
console.dir(argv._);