From 7963e7cf13c57abf8aa7f145df3c76583b28b828 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 8 Jan 2008 19:02:40 +0000 Subject: [PATCH] Repeat available configuration options before prompt (#2289). The code isn't very clean but that's the best I could come up with. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5098 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/pwmconfig | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index c02a9424..c117e918 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ SVN pwmconfig: Really hide errors on sysfs writes Deal gracefully with read-only pwm_enable files Warn about outputs found in automatic mode + Repeat available configuration options before prompt (#2289) sensord: Fix rrd support (#2276) Use the same colors for daily and weekly charts Drop workaround needed by old versions of rrdtool diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index f2a67208..ab4422ec 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -622,7 +622,11 @@ DEFMAXTEMP=60 DEFMINSTART=150 DEFMINSTOP=100 -#the section below has a high potential for usability improvements +# "select" won't reapeat the list of options, so we enclose it in a +# never-ending loop so that it starts over again with each iteration. +# I admit it's not exactly nice, but I do not have a better idea to +# keep usability at an acceptable level. +while [ 1 ] ; do echo echo 'Select fan output to configure, or other action:' select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show configuration"; do @@ -630,8 +634,9 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co "Change INTERVAL") echo echo "Current interval is $INTERVAL seconds." - echo -n "Enter the interval at which fancontrol should update PWM values (in s):" - read INTERVAL ;; #check user input here + echo -n "Enter the interval at which fancontrol should update PWM values (in s): " + read INTERVAL #check user input here + break ;; "Just quit") exit ;; "Save and quit") @@ -654,7 +659,8 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co echo " MINPWM=`echo $MINPWM |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" echo " MAXPWM=`echo $MAXPWM |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" done - echo ;; + echo + break ;; "`echo ${pwmactive} |sed -e 's/ /\n/g' | egrep \"${pwms}\"`" ) pwmsed=`echo ${pwms} | sed -e 's/\//\\\\\//g'` #escape / for sed @@ -787,11 +793,12 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co fi echo break; - done ;; + done + break ;; *) - grep $pwm - - echo "No such option. Enter a number." ;; + echo "No such option. Enter a number." + break ;; esac done +done