Merge pull request #145 from dylanaraps/osx_codename

OSX Codename support
This commit is contained in:
Dylan Araps 2016-03-13 22:40:20 +11:00
commit 1aa4c64f5d
4 changed files with 42 additions and 4 deletions

View File

@ -284,6 +284,7 @@ alias fetch2="fetch \
NOTE: You can supply multiple args. eg.
'fetch --disable cpu gpu disk shell'
--osx_buildversion on/off Hide/Show Mac OS X build version.
--osx_codename on/off Hide/Show Mac OS X codename.
--os_arch on/off Hide/Show Windows architecture.
--speed_type type Change the type of cpu speed to display.
Possible values: current, min, max, bios,

View File

@ -62,6 +62,10 @@ kernel_shorthand="on"
# --osx_buildversion on/off
osx_buildversion="on"
# Mac OS X hide/show codename
# --osx_codename on/off
osx_codename="on"
# Show 'x86_64' and 'x86' in 'Distro:' output.
# --os_arch on/off
os_arch="on"

View File

@ -84,6 +84,10 @@ kernel_shorthand="on"
# --osx_buildversion on/off
osx_buildversion="on"
# Mac OS X hide/show codename
# --osx_codename on/off
osx_codename="on"
# Show 'x86_64' and 'x86' in 'Distro:' output.
# --os_arch on/off
os_arch="on"
@ -464,7 +468,21 @@ case "$os" in
;;
"Mac OS X")
distro="Mac OS X $(sw_vers -productVersion)"
osx_version=$(sw_vers -productVersion)
case "${osx_version%.*}" in
"10.4") codename="Mac OS X Tiger" ;;
"10.5") codename="Mac OS X Leopard" ;;
"10.6") codename="Mac OS X Snow Leopard" ;;
"10.7") codename="Mac OS X Lion" ;;
"10.8") codename="OS X Mountain Lion" ;;
"10.9") codename="OS X Mavericks" ;;
"10.10") codename="OS X Yosemite" ;;
"10.11") codename="OS X El Capitan" ;;
*) codename="Mac OS X" ;;
esac
distro="$codename $osx_version"
[ "$osx_buildversion" == "on" ] && distro+=" $(sw_vers -buildVersion)"
;;
@ -2209,8 +2227,9 @@ colors () {
setcolors 4 8
;;
"Mac"* | "Manjaro"* | "Deepin"*)
*"OS X"* )
setcolors 2 3 1 1 5 4
ascii_distro="mac"
;;
"OpenMandriva"*)
@ -2242,7 +2261,7 @@ colors () {
setcolors 3 3 6 1 8
;;
"OpenSuse"*)
"OpenSuse"* | "Manjaro"* | "Deepin"*)
setcolors 2 7
;;
@ -2448,6 +2467,7 @@ usage () { cat << EOF
NOTE: You can supply multiple args. eg.
'neofetch --disable cpu gpu disk shell'
--osx_buildversion on/off Hide/Show Mac OS X build version.
--osx_codename on/off Hide/Show Mac OS X codename.
--os_arch on/off Hide/Show Windows architecture.
--speed_type type Change the type of cpu speed to display.
Possible values: current, min, max, bios,
@ -2569,6 +2589,7 @@ while [ "$1" ]; do
# Info
--os_arch) os_arch="$2" ;;
--osx_buildversion) osx_buildversion="$2" ;;
--osx_codename) osx_codename="$2" ;;
--speed_type) speed_type="$2" ;;
--kernel_shorthand) kernel_shorthand="$2" ;;
--uptime_shorthand) uptime_shorthand="$2" ;;
@ -2709,6 +2730,16 @@ done
# }}}
# OS overides {{{
# Overide OS X codename
case "$osx_codename" in
"off") distro=${distro/${codename}/Mac OS X} ;;
esac
# }}}
# Call Functions and Finish Up {{{
@ -2779,6 +2810,5 @@ if [ "$scrot" == "on" ]; then
takescrot
fi
# }}}

View File

@ -22,6 +22,9 @@ NOTE: You can supply multiple args. eg.
.B \--osx_buildversion 'on/off'
Hide/Show Mac OS X build version.
.TP
.B \--osx_codename 'on/off'
Hide/Show Mac OS X codename.
.TP
.B \--os_arch 'on/off'
Hide/Show Windows architecture.
.TP