CPU: Simplify format check
This commit is contained in:
parent
f7686ee8e8
commit
dc08df12ac
25
neofetch
25
neofetch
|
@ -862,26 +862,19 @@ get_cpu() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Format the output
|
# Fix for speeds under 1ghz
|
||||||
case "$os" in
|
if [[ "$speed" ]]; then
|
||||||
"Mac OS X" | "iPhone OS") ;;
|
if [[ -z "${speed:1}" ]]; then
|
||||||
*)
|
speed="0.${speed}"
|
||||||
# Fix for speeds under 1ghz
|
else
|
||||||
if [[ -z "${speed:1}" ]]; then
|
speed="${speed:0:1}.${speed:1}"
|
||||||
speed="0.${speed}"
|
fi
|
||||||
else
|
|
||||||
speed="${speed:0:1}.${speed:1}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cpu="$cpu @ ${speed}GHz $temp"
|
cpu="$cpu @ ${speed}GHz $temp"
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
# Remove uneeded patterns from cpu output
|
# Remove uneeded patterns from cpu output
|
||||||
# This is faster than sed/gsub
|
|
||||||
cpu="${cpu//(tm)}"
|
|
||||||
cpu="${cpu//(TM)}"
|
cpu="${cpu//(TM)}"
|
||||||
cpu="${cpu//(r)}"
|
|
||||||
cpu="${cpu//(R)}"
|
cpu="${cpu//(R)}"
|
||||||
cpu="${cpu//CPU}"
|
cpu="${cpu//CPU}"
|
||||||
cpu="${cpu//Processor}"
|
cpu="${cpu//Processor}"
|
||||||
|
|
Reference in New Issue