From ed41c15c6a05a1d6188898dac3fe0799bdcae607 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sat, 8 Oct 2016 12:40:59 +0700 Subject: [PATCH 1/3] Expanded distro_shorthand to Mac OS X --- README.md | 4 +--- config/config | 10 +--------- neofetch | 26 +++++++++++++++----------- neofetch.1 | 8 +------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 5e09919a..7c7555dc 100644 --- a/README.md +++ b/README.md @@ -357,8 +357,6 @@ alias neofetch2="neofetch \ in the output. 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 OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, @@ -368,7 +366,7 @@ alias neofetch2="neofetch \ Possible values: name, speed, tiny, on, off --cpu_cores on/off Whether or not to display the number of CPU cores --distro_shorthand on/off Shorten the output of distro (tiny, on, off) - NOTE: This is only possible on Linux + NOTE: This is only possible on Linux and Mac OS X --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor diff --git a/config/config b/config/config index 0c256066..066dec4a 100644 --- a/config/config +++ b/config/config @@ -62,17 +62,9 @@ kernel_shorthand="on" # Distro # Shorten the output of distro (tiny, on, off) -# NOTE: This is only possible on Linux +# NOTE: This is only possible on Linux and Mac OS X distro_shorthand="off" -# Mac OS X hide/show build version -# --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" diff --git a/neofetch b/neofetch index c5702e0e..3a7ebf83 100755 --- a/neofetch +++ b/neofetch @@ -188,6 +188,20 @@ getdistro() { *) codename="Mac OS X" ;; esac distro="$codename $osx_version $osx_build" + + case "$distro_shorthand" in + "on") distro="${distro/ ${osx_build}}" ;; + "tiny") + case "$osx_version" in + "10.4"*|"10.5"*|"10.6"*|"10.7"*) + distro="${distro/${codename}/Mac OS X}" ;; + "10.8"*|"10.9"*|"10.10"*|"10.11"*) + distro="${distro/${codename}/OS X}" ;; + "10.12"*) + distro="${distro/${codename}/macOS}" ;; + esac + distro="${distro/ ${osx_build}}" ;; + esac ;; "iPhone OS") @@ -225,12 +239,6 @@ getdistro() { [ "$os_arch" == "on" ] && \ distro+=" $(uname -m)" - [ "$osx_codename" == "off" ] && \ - distro="${distro/${codename}/Mac OS X}" - - [ "$osx_buildversion" == "off" ] && \ - distro="${distro/ ${osx_build}}" - [ "${ascii_distro:-auto}" == "auto" ] && \ ascii_distro="$(trim "$distro")" } @@ -2884,8 +2892,6 @@ usage() { cat << EOF in the output. 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 OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, @@ -2895,7 +2901,7 @@ usage() { cat << EOF Possible values: name, speed, tiny, on, off --cpu_cores on/off Whether or not to display the number of CPU cores --distro_shorthand on/off Shorten the output of distro (tiny, on, off) - NOTE: This is only possible on Linux + NOTE: This is only possible on Linux and Mac OS X --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor @@ -3018,8 +3024,6 @@ getargs() { case $1 in # Info --os_arch) os_arch="$2" ;; - --osx_buildversion) osx_buildversion="$2" ;; - --osx_codename) osx_codename="$2" ;; --cpu_cores) cpu_cores="$2" ;; --speed_type) speed_type="$2" ;; --distro_shorthand) distro_shorthand="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 59141f72..d294ccd5 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -19,12 +19,6 @@ NOTE: You can supply multiple args. eg. .br \'neofetch --disable cpu gpu disk shell\' .TP -.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 OS architecture. .TP @@ -47,7 +41,7 @@ Whether or not to display the number of CPU cores .B \--distro_shorthand 'on/off' Shorten the output of distro (tiny, on, off) .br -NOTE: This is only possible on Linux +NOTE: This is only possible on Linux and Mac OS X .TP .B \--kernel_shorthand 'on/off' Shorten the output of kernel From fe6588d8b6bfedc0763da6cddc2df89282629dc6 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Fri, 14 Oct 2016 19:09:57 +0700 Subject: [PATCH 2/3] Expanded distro_shorthand to Solaris --- README.md | 2 +- config/config | 2 +- neofetch | 7 +++++-- neofetch.1 | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7c7555dc..41e7702b 100644 --- a/README.md +++ b/README.md @@ -366,7 +366,7 @@ alias neofetch2="neofetch \ Possible values: name, speed, tiny, on, off --cpu_cores on/off Whether or not to display the number of CPU cores --distro_shorthand on/off Shorten the output of distro (tiny, on, off) - NOTE: This is only possible on Linux and Mac OS X + NOTE: This is only possible on Linux, Mac OS X, and Solaris --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor diff --git a/config/config b/config/config index 066dec4a..89199832 100644 --- a/config/config +++ b/config/config @@ -62,7 +62,7 @@ kernel_shorthand="on" # Distro # Shorten the output of distro (tiny, on, off) -# NOTE: This is only possible on Linux and Mac OS X +# NOTE: This is only possible on Linux, Mac OS X, and Solaris distro_shorthand="off" # Show 'x86_64' and 'x86' in 'Distro:' output. diff --git a/neofetch b/neofetch index 3a7ebf83..16b96b26 100755 --- a/neofetch +++ b/neofetch @@ -231,7 +231,10 @@ getdistro() { ;; "Solaris") - distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" + case "$distro_shorthand" in + "on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;; + *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; + esac ;; esac @@ -2901,7 +2904,7 @@ usage() { cat << EOF Possible values: name, speed, tiny, on, off --cpu_cores on/off Whether or not to display the number of CPU cores --distro_shorthand on/off Shorten the output of distro (tiny, on, off) - NOTE: This is only possible on Linux and Mac OS X + NOTE: This is only possible on Linux, Mac OS X, and Solaris --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor diff --git a/neofetch.1 b/neofetch.1 index d294ccd5..986fb72c 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -41,7 +41,7 @@ Whether or not to display the number of CPU cores .B \--distro_shorthand 'on/off' Shorten the output of distro (tiny, on, off) .br -NOTE: This is only possible on Linux and Mac OS X +NOTE: This is only possible on Linux, Mac OS X, and Solaris .TP .B \--kernel_shorthand 'on/off' Shorten the output of kernel From 710fd49887db29b86db05d0d298d4cb9b4809446 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sat, 15 Oct 2016 09:08:12 +0700 Subject: [PATCH 3/3] Added function to check if old flags is still present on configs --- neofetch | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/neofetch b/neofetch index 16b96b26..4d321be9 100755 --- a/neofetch +++ b/neofetch @@ -2703,6 +2703,15 @@ err() { # }}} +# Check for old flags {{{ + +checkoldflags() { + [ -n "$osx_buildversion" ] && err "\$osx_buildversion is deprecated, use \$distro_shorthand instead." + [ -n "$osx_codename" ] && err "\$osx_codename is deprecated, use \$distro_shorthand instead." +} + +# }}} + # Get script directory {{{ getscriptdir() { @@ -3208,6 +3217,7 @@ getargs() { main() { getos getdefaultconfig 2>/dev/null + checkoldflags getargs "$@" getdistro