Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
updating version to 1.5.3 and fixing bug with batter to hopefully fix…
Browse files Browse the repository at this point in the history
… the issue with mac pros
  • Loading branch information
Jeff Hann committed Dec 1, 2015
1 parent bf8d128 commit 78c3df3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/archey
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# archey-osx 1.5.3 (https://github.com/obihann/archey-osx/)

# test to see if bash supports arrays
arraytest[0]='test' || (echo 'Error: Arrays are not supported in this version of
bash.' && exit 2)
Expand Down Expand Up @@ -37,6 +39,8 @@ do
opt_offline=t
;;
-h|--help)
echo "Archey OS X 1.5.3"
echo
echo "Usage: $0 [options]"
echo
echo " -p --packager Use auto detected package system (default packager: ${detectedpackager})."
Expand Down Expand Up @@ -76,7 +80,7 @@ uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
shell="$SHELL"
terminal="$TERM ${TERM_PROGRAM//_/ }"
cpu=$(sysctl -n machdep.cpu.brand_string)
battery=$(ioreg -c AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
battery=$(ioreg -c AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')

# removes (R) and (TM) from the CPU name so it fits in a standard 80 window
cpu=$(echo "$cpu" | awk '$1=$1' | sed 's/([A-Z]\{1,2\})//g')
Expand Down Expand Up @@ -126,7 +130,7 @@ fieldlist[${#fieldlist[@]}]="${textColor}CPU:${normal} ${cpu}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Memory:${normal} ${ram}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Disk:${normal} ${disk}${normal}"
if [ ! -z $battery ]; then
fieldlist[${#fieldlist[@]}]="${textColor}Battery:${normal} ${battery}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Battery:${normal} ${battery}${normal}%"
fi
if [ "${opt_offline}" = f ]; then
fieldlist[${#fieldlist[@]}]="${textColor}IP Address:${normal} ${ip}${normal}"
Expand Down

0 comments on commit 78c3df3

Please sign in to comment.