Merge pull request #131 from iandrewt/cpu_shorthand

added ability to shorten cpu output
This commit is contained in:
Dylan Araps 2016-03-11 10:46:07 +11:00
commit 49de8d032f
5 changed files with 44 additions and 0 deletions

2
1.5.md
View File

@ -10,6 +10,8 @@
**Disk Usage**<br \> **Disk Usage**<br \>
- Only display usage of local disks. - Only display usage of local disks.
**CPU Information**<br \>
- Option to shorten CPU name to just name, speed, tiny, on, or off
### Ascii ### Ascii

View File

@ -269,6 +269,8 @@ alias fetch2="fetch \
Possible values: current, min, max, bios, Possible values: current, min, max, bios,
scaling_current, scaling_min, scaling_max scaling_current, scaling_min, scaling_max
NOTE: This only support Linux with cpufreq. NOTE: This only support Linux with cpufreq.
--cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--gpu_shorthand on/off Shorten the output of GPU --gpu_shorthand on/off Shorten the output of GPU

View File

@ -93,6 +93,11 @@ shell_version="off"
# scaling_current, scaling_min, scaling_max # scaling_current, scaling_min, scaling_max
speed_type="max" speed_type="max"
# CPU shorthand
# Decice to show name only, speed only, or short info
# --cpu_shorthand name, speed, tiny, on, off
cpu_shorthand="off"
# GPU # GPU

View File

@ -113,6 +113,11 @@ shell_version="off"
# scaling_current, scaling_min, scaling_max # scaling_current, scaling_min, scaling_max
speed_type="max" speed_type="max"
# CPU shorthand
# Decice to show name only, speed only, or short info
# --cpu_shorthand name, speed, tiny, on, off
cpu_shorthand="off"
# GPU # GPU
@ -855,6 +860,28 @@ getcpu () {
cpu=${cpu// Six-Core} cpu=${cpu// Six-Core}
cpu=${cpu// Eight-Core} cpu=${cpu// Eight-Core}
cpu=${cpu// with Radeon HD Graphics} cpu=${cpu// with Radeon HD Graphics}
# Make the output of cpu shorter
case "$cpu_shorthand" in
"name")
cpu=${cpu/@*}
;;
"speed")
cpu=${cpu#*@ }
;;
"on" | "tiny")
cpu=${cpu/Intel }
cpu=${cpu/Core }
cpu=${cpu/Core? Duo }
cpu=${cpu/AMD }
case "$cpu_shorthand" in
"tiny") cpu${cpu/@*} ;;
esac
;;
esac
} }
# }}} # }}}
@ -2295,6 +2322,8 @@ usage () { cat << EOF
Possible values: current, min, max, bios, Possible values: current, min, max, bios,
scaling_current, scaling_min, scaling_max scaling_current, scaling_min, scaling_max
NOTE: This only support Linux with cpufreq. NOTE: This only support Linux with cpufreq.
--cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--gpu_shorthand on/off Shorten the output of GPU --gpu_shorthand on/off Shorten the output of GPU
@ -2396,6 +2425,7 @@ while [ "$1" ]; do
--speed_type) speed_type="$2" ;; --speed_type) speed_type="$2" ;;
--kernel_shorthand) kernel_shorthand="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;;
--uptime_shorthand) uptime_shorthand="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;;
--cpu_shorthand) cpu_shorthand="$2" ;;
--gpu_shorthand) gpu_shorthand="$2" ;; --gpu_shorthand) gpu_shorthand="$2" ;;
--gtk_shorthand) gtk_shorthand="$2" ;; --gtk_shorthand) gtk_shorthand="$2" ;;
--gtk2) gtk2="$2" ;; --gtk2) gtk2="$2" ;;

View File

@ -33,6 +33,11 @@ scaling_current, scaling_min, scaling_max
.br .br
NOTE: This only support Linux with cpufreq. NOTE: This only support Linux with cpufreq.
.TP .TP
.B \--cpu_shorthand 'type'
Shorten the output of CPU
.br
Possible values: name, speed, tiny, on, off
.TP
.B \--kernel_shorthand 'on/off' .B \--kernel_shorthand 'on/off'
Shorten the output of kernel Shorten the output of kernel
.TP .TP