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

Removed "default: false" on verbose. #1418

Merged
merged 2 commits into from
Sep 6, 2019
Merged

Removed "default: false" on verbose. #1418

merged 2 commits into from
Sep 6, 2019

Conversation

sliftist
Copy link
Contributor

Proposal to remove "default: false" on verbose in the README.

I was mildly confused when I copied the example and called it with -v, expecting no value to default the value to true. However it appears as if the default value overrides both the "not passed" value, and the "passed with no value" parameter. This makes me believe "default: false" should never be used, as the default of default is effectively false.

At the very least I believe it shouldn't be part of the example in the README, especially on conjunction with the verbose parameter, which makes a program that uses verbose differently than any program I have ever seen.

Removed "default: false" on verbose. I was mildly confused when I copied the example and called it with `-v`, expecting no value to default the value to true. However it appears as if the default value overrides both the "not passed" value, and the "passed with no value" parameter. This makes me believe "default: false" should never be used, as the default of default is effectively false.

At the very least I believe it shouldn't be part of the example in the README, especially on conjunction with the verbose parameter, which makes a program that uses verbose differently than any program I have ever seen.
README.md Outdated
@@ -79,8 +79,7 @@ require('yargs') // eslint-disable-line
serve(argv.port)
})
.option('verbose', {
alias: 'v',
default: false
alias: 'v'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps add a describe: 'run with verbose logging', I'm comfortable with dropping the false 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want this example to show a standard way of defining a verbose option, I suggest also adding a type: 'count', as it is the way a verbose option often works (v = 0 when the option is absent, 1 when it is present, up to n when it is repeated, 4 for example with -vvvv).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of suggesting this too, but thought it might be a bit too advanced of a feature to show off near the top of the README. I'm comfortable with whichever approach @sliftist takes 👍 but think it would be good to add a description either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I didn't know type: 'count' worked like that. Both changes added to the pull request.

@bcoe bcoe merged commit a5d1c75 into yargs:master Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants