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

Fix "bad math expression" for battery with UPS #549

Merged
merged 1 commit into from
Nov 20, 2018
Merged

Fix "bad math expression" for battery with UPS #549

merged 1 commit into from
Nov 20, 2018

Conversation

nomaed
Copy link
Contributor

@nomaed nomaed commented Nov 5, 2018

Fixes #245 spaceship_battery:56: bad math expression: operator expected at '100' if multiple battery multiple are reported (on macOS, at least).
Happens when pmset reports secondary charge due to UPS.

Instead of only testing for existence of "InternalBattery" in pmset -g batt result, will filter this row from the beginning so no other charges are combined into the result.

Fixes #245 `spaceship_battery:56: bad math expression: operator expected at '100'` if
multiple battery statuses are reported (on macOS, at least).
Happens when pmset reports secondary charge due to UPS.
@nomaed
Copy link
Contributor Author

nomaed commented Nov 16, 2018

@denysdovhan any chance you could take a look?

@salmanulfarzy salmanulfarzy added improvement A PR that make small changes for improving UX, performance, readability, etc review-required labels Nov 17, 2018
@denysdovhan
Copy link
Member

Sorry missed this PR. LGTM. The code looks cleaner.

@salmanulfarzy do you approve?

@salmanulfarzy
Copy link
Member

Code looks good. Haven't tested this, But if this doesn't break anything, then 👍

@denysdovhan
Copy link
Member

Haven't tested this, But if this doesn't break anything, then 👍

We need to cover this section with tests. It's stupid to hope that nothing was broken.

@denysdovhan denysdovhan merged commit d1d0dec into spaceship-prompt:master Nov 20, 2018
@nomaed nomaed deleted the fix-multi-battery branch November 21, 2018 16:21
@salmanulfarzy salmanulfarzy mentioned this pull request Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A PR that make small changes for improving UX, performance, readability, etc
Development

Successfully merging this pull request may close these issues.

None yet

3 participants