-
Notifications
You must be signed in to change notification settings - Fork 116
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
fix(cli): fix setting flag to false #135
Conversation
Since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has given us a lot of problems so it needs some tests
@@ -31,22 +31,33 @@ export class Option { | |||
|
|||
getNumber(): number { | |||
let value = this.getValue_(); | |||
if (value && typeof value === 'number') { | |||
return +value; | |||
if (value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if value
is 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. My fix is for strings or numbers to return the +value
. For booleans, I plan to return null
.
I agree. I'll put tests together. |
cefc610
to
9bebf21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits
return Boolean(value); | ||
if (value != null) { | ||
if (typeof value === 'string') { | ||
return !Boolean(value === '0' || value === 'false'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the use of Boolean
? The inside is clearly a boolean
if (typeof value === 'string') { | ||
return !Boolean(value === '0' || value === 'false'); | ||
} else if (typeof value === 'number') { | ||
return Boolean(value !== 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
- This fixes `webdriver-manager update --gecko=false` - This does not fix `webdriver-manager update --gecko=0`. Minimist interprets 0 as true. - Add options and programs unit tests closes angular#110
Done. |
webdriver-manager update --gecko=false
webdriver-manager update --gecko=0
. Minimist interprets 0 as true.closes #110