matchai / spacefish

🚀🐟 The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
963 stars 79 forks source link

Battery section: ACPI use only first battery value #124

Closed matchai closed 5 years ago

matchai commented 5 years ago

It appears this issue would also happen on spacefish, and the solution seems like a rather quick fix. 👍

🐟 spacefish-bot — Pull request copied from: https://github.com/denysdovhan/spaceship-prompt/pull/583.

When trying to show battery percentage with ACPI command having with multiple batteries causes bad math expression.

Fixes denysdovhan/spaceship-prompt#245

For the output of:

$ acpi -b 
Battery 0: Unknown, 97%
Battery 1: Unknown, 98%

Original logic:

$ acpi -b 2>/dev/null | awk '{print $4}' | tr -d '%[,;]'
97
98

After piping acpi -b through head -1:

$ acpi -b 2>/dev/null | head -1 | awk '{print $4}' | tr -d '%[,;]'
97
matchai commented 5 years ago

:tada: This issue has been resolved in version 2.0.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: