From 11c680abd33823716063ef4e40531b53968b13ec Mon Sep 17 00:00:00 2001 From: Marcel Trautwein Date: Tue, 3 Nov 2015 20:58:53 +0100 Subject: [PATCH 1/2] 1. ioreg -c -r is much faster, thx to meal (http://hints.macworld.com/article.php?story=20100130123935998) for the tested awk 'grep' 2. disable package manager per default since it costs more than 300ms saved: 500ms \! --- bin/archey | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/archey b/bin/archey index 695afb9..9eed996 100755 --- a/bin/archey +++ b/bin/archey @@ -6,11 +6,11 @@ bash.' && exit 2) # Detect the packager. if [ -x /usr/local/bin/brew ]; then - packager=homebrew + detectedpackager=homebrew elif command -v port >/dev/null; then - packager=macports + detectedpackager=macports else - packager=none + detectedpackager=none fi # Get the command line options @@ -20,6 +20,9 @@ opt_offline=f for arg in "$@" do case "${arg}" in + -p|--packager) + packager=$detectedpackager + ;; -m|--macports) packager=macports ;; @@ -36,7 +39,8 @@ do -h|--help) echo "Usage: $0 [options]" echo - echo " -m --macports Use MacPorts as package system (default packager: ${packager})." + echo " -p --packager Use auto detected package system (default packager: ${detectedpackager})." + echo " -m --macports Force use MacPorts as package system." echo " -b --nocolor Turn color off." echo " -c --color Force the color on (overrides --nocolor)." echo " -o --offline Disable the IP address check." @@ -72,7 +76,7 @@ uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/') shell="$SHELL" terminal="$TERM ${TERM_PROGRAM//_/ }" cpu=$(sysctl -n machdep.cpu.brand_string) -battery=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}') +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') @@ -115,7 +119,9 @@ fieldlist[${#fieldlist[@]}]="${textColor}Kernel:${normal} ${kernel}${normal}" fieldlist[${#fieldlist[@]}]="${textColor}Uptime:${normal} ${uptime}${normal}" fieldlist[${#fieldlist[@]}]="${textColor}Shell:${normal} ${shell}${normal}" fieldlist[${#fieldlist[@]}]="${textColor}Terminal:${normal} ${terminal}${normal}" -fieldlist[${#fieldlist[@]}]="${textColor}Packages:${normal} ${packagehandler}${normal}" +if [ ${packagehandler} -ne 0 ]; then + fieldlist[${#fieldlist[@]}]="${textColor}Packages:${normal} ${packagehandler}${normal}" +fi fieldlist[${#fieldlist[@]}]="${textColor}CPU:${normal} ${cpu}${normal}" fieldlist[${#fieldlist[@]}]="${textColor}Memory:${normal} ${ram}${normal}" fieldlist[${#fieldlist[@]}]="${textColor}Disk:${normal} ${disk}${normal}" From bf8d12806ad91a4fa5747cb345641e4e178b574e Mon Sep 17 00:00:00 2001 From: Jeff Hann Date: Thu, 26 Nov 2015 10:32:14 -0400 Subject: [PATCH 2/2] updating changelog --- CHANGELOG.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e486cc..df74899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,15 @@ # Change Log ## [Unreleased](https://github.com/obihann/archey-osx/tree/HEAD) -[Full Changelog](https://github.com/obihann/archey-osx/compare/1.5.1...HEAD) -## [1.5.1](https://github.com/obihann/archey-osx/tree/1.5.1) (2015-11-03) -[Full Changelog](https://github.com/obihann/archey-osx/compare/v1.5-pr...1.5.1) +[Full Changelog](https://github.com/obihann/archey-osx/compare/1.5.1...HEAD) -**Closed issues:** +**Merged pull requests:** -- Download link in Readme.md returns 404 Not Found [\#33](https://github.com/obihann/archey-osx/issues/33) +- Performance improvements [\#34](https://github.com/obihann/archey-osx/pull/34) ([childnode](https://github.com/childnode)) -## [1.5.1-pr](https://github.com/obihann/archey-osx/tree/1.5.1-pr) (2015-11-03) -[Full Changelog](https://github.com/obihann/archey-osx/compare/v1.5...1.5.1-pr) +## [1.5.1](https://github.com/obihann/archey-osx/tree/1.5.1) (2015-11-03) +[Full Changelog](https://github.com/obihann/archey-osx/compare/1.5.1-pr...1.5.1) **Fixed bugs:** @@ -19,21 +17,31 @@ - Why my uptime string length is so long? [\#18](https://github.com/obihann/archey-osx/issues/18) - 1.5 IP timeout & Battery [\#17](https://github.com/obihann/archey-osx/issues/17) +**Closed issues:** + +- Download link in Readme.md returns 404 Not Found [\#33](https://github.com/obihann/archey-osx/issues/33) + **Merged pull requests:** - prepping for v1.5.1 [\#32](https://github.com/obihann/archey-osx/pull/32) ([obihann](https://github.com/obihann)) - ip address caching [\#31](https://github.com/obihann/archey-osx/pull/31) ([obihann](https://github.com/obihann)) +- Fixing uptime [\#24](https://github.com/obihann/archey-osx/pull/24) ([obihann](https://github.com/obihann)) +- updating the regex used to display uptime [\#21](https://github.com/obihann/archey-osx/pull/21) ([obihann](https://github.com/obihann)) + +## [1.5.1-pr](https://github.com/obihann/archey-osx/tree/1.5.1-pr) (2015-11-03) +[Full Changelog](https://github.com/obihann/archey-osx/compare/v1.5...1.5.1-pr) + +**Merged pull requests:** + - Develop [\#30](https://github.com/obihann/archey-osx/pull/30) ([obihann](https://github.com/obihann)) - adding check if battery string is empty [\#29](https://github.com/obihann/archey-osx/pull/29) ([obihann](https://github.com/obihann)) - Adding an array list. [\#28](https://github.com/obihann/archey-osx/pull/28) ([slice27](https://github.com/slice27)) - updating changelog [\#26](https://github.com/obihann/archey-osx/pull/26) ([obihann](https://github.com/obihann)) - Adding offline mode [\#25](https://github.com/obihann/archey-osx/pull/25) ([obihann](https://github.com/obihann)) -- Fixing uptime [\#24](https://github.com/obihann/archey-osx/pull/24) ([obihann](https://github.com/obihann)) - Configure logo file location via $ARCHEY\_LOGO\_FILE [\#22](https://github.com/obihann/archey-osx/pull/22) ([theunraveler](https://github.com/theunraveler)) -- updating the regex used to display uptime [\#21](https://github.com/obihann/archey-osx/pull/21) ([obihann](https://github.com/obihann)) ## [v1.5](https://github.com/obihann/archey-osx/tree/v1.5) (2015-10-06) -[Full Changelog](https://github.com/obihann/archey-osx/compare/v1.4...v1.5) +[Full Changelog](https://github.com/obihann/archey-osx/compare/1.4...v1.5) **Merged pull requests:** @@ -46,11 +54,11 @@ - Simplified ram calculation. [\#5](https://github.com/obihann/archey-osx/pull/5) ([docwhat](https://github.com/docwhat)) - Get user's shell from dscl. [\#3](https://github.com/obihann/archey-osx/pull/3) ([lucsky](https://github.com/lucsky)) -## [v1.4](https://github.com/obihann/archey-osx/tree/v1.4) (2014-03-09) -[Full Changelog](https://github.com/obihann/archey-osx/compare/1.4...v1.4) - ## [1.4](https://github.com/obihann/archey-osx/tree/1.4) (2014-03-09) -[Full Changelog](https://github.com/obihann/archey-osx/compare/1.3...1.4) +[Full Changelog](https://github.com/obihann/archey-osx/compare/v1.4...1.4) + +## [v1.4](https://github.com/obihann/archey-osx/tree/v1.4) (2014-03-09) +[Full Changelog](https://github.com/obihann/archey-osx/compare/1.3...v1.4) ## [1.3](https://github.com/obihann/archey-osx/tree/1.3) (2014-02-07) [Full Changelog](https://github.com/obihann/archey-osx/compare/1.2...1.3) @@ -72,4 +80,4 @@ ## [1.0](https://github.com/obihann/archey-osx/tree/1.0) (2013-09-13) -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file