From d90d7259a9408862b6c1f7cb902042cad914a2ac Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 1 Feb 2016 14:45:53 +1100 Subject: [PATCH] Added option to show architecture for all OS types with '' --- README.md | 1 + config/config | 6 +++--- fetch | 23 +++++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index be58bd1d..789cb57a 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ alias fetch2="fetch \ usage: ${0##*/} --option "value" Info: + --os_arch on/off Hide/Show Windows architecture. --osx_buildversion Hide/Show Mac OS X build version. --speed_type Change the type of cpu speed to display. Possible values: current, min, max, bios, diff --git a/config/config b/config/config index 58543ce3..894a56b7 100644 --- a/config/config +++ b/config/config @@ -59,9 +59,9 @@ kernel_shorthand="on" # --osx_buildversion on/off osx_buildversion="on" -# Show '64-bit' / '32-bit' in 'Distro:' -# --windows_bits on /off -windows_bits="on" +# Show 'x86_64' and 'x86' in 'Distro:' output. +# --os_arch on/off +os_arch="on" # Uptime diff --git a/fetch b/fetch index 997078cd..96347ded 100755 --- a/fetch +++ b/fetch @@ -79,9 +79,9 @@ kernel_shorthand="on" # --osx_buildversion on/off osx_buildversion="on" -# Show '64-bit' / '32-bit' in 'Distro:' -# --windows_bits on /off -windows_bits="on" +# Show 'x86_64' and 'x86' in 'Distro:' output. +# --os_arch on/off +os_arch="on" # Uptime @@ -407,12 +407,8 @@ case "$os" in "Windows") distro="$(wmic os get Caption /value)" - [ "$windows_bits" == "on" ] && \ - distro+=" $(wmic os get OSArchitecture /value)" - # Strip crap from the output of wmic distro=${distro/Caption'='} - distro=${distro/OSArchitecture'='} distro=${distro//[[:space:]]/ } distro=${distro// } distro=${distro/Microsoft } @@ -425,7 +421,14 @@ esac ascii_distro="$distro" getdistro () { - distro="$distro" + # Overflow integer to get architecture + if [ "$os_arch" == "on" ]; then + if ((1<<32)); then + distro+=" x86_64" + else + distro+=" x86" + fi + fi } @@ -1878,7 +1881,7 @@ usage () { cat << EOF Info: --osx_buildversion Hide/Show Mac OS X build version. - --windows_bits on/off Hide/Show Windows architecture. + --os_arch on/off Hide/Show Windows architecture. --speed_type Change the type of cpu speed to display. Possible values: current, min, max, bios, scaling_current, scaling_min, scaling_max @@ -1979,7 +1982,7 @@ exit 1 while [ "$1" ]; do case $1 in # Info - --windows_bits) windows_bits="$2" ;; + --os_arch) os_arch="$2" ;; --osx_buildversion) osx_buildversion="$2" ;; --speed_type) speed_type="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;;