1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 21:41:57 +00:00

Consolidated if statements and fixed OSX cpu cores command

This commit is contained in:
David McKay 2016-04-25 07:08:36 +01:00
parent 78b4ab0414
commit d2728f0dd1

View file

@ -580,12 +580,6 @@ prompt_load() {
local current_state="unknown"
local cores
if [[ "$OS" == "OSX" ]]; then
cores=$(sysctl -a | grep machdep.cpu)
else
cores=$(nproc)
fi
typeset -AH load_states
load_states=(
'critical' 'red'
@ -595,8 +589,10 @@ prompt_load() {
if [[ "$OS" == "OSX" ]]; then
load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1)
cores=$(sysctl -n hw.physicalcpu)
else
load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1)
cores=$(nproc)
fi
# Replace comma