Rename user response variables (choice)

This commit is contained in:
rmm 2024-06-16 17:07:46 +02:00
parent c50137f8f0
commit 23c6c1f496

View File

@ -77,8 +77,8 @@ function install_packages {
# Check if the 'sensors' command is available on the system # Check if the 'sensors' command is available on the system
if (! command -v sensors &>/dev/null); then if (! command -v sensors &>/dev/null); then
# If the 'sensors' command is not available, prompt the user to install lm-sensors # If the 'sensors' command is not available, prompt the user to install lm-sensors
local choice=$(ask "lm-sensors is not installed. Would you like to install it? (y/n)") local choiceInstallLmSensors=$(ask "lm-sensors is not installed. Would you like to install it? (y/n)")
case "$choice" in case "$choiceInstallLmSensors" in
[yY]) [yY])
# If the user chooses to install lm-sensors, update the package list and install the package # If the user chooses to install lm-sensors, update the package list and install the package
apt-get update apt-get update
@ -127,8 +127,8 @@ function configure {
if (echo "$sensorsOutput" | grep -q "coretemp-"); then if (echo "$sensorsOutput" | grep -q "coretemp-"); then
# Intel CPU # Intel CPU
# Prompt user for which temperature to use # Prompt user for which temperature to use
local choice=$(ask "Do you wish to display temperatures for all cores [C] or just an average temperature per CPU [a]? (C/a)") local choiceTempDisplayType=$(ask "Do you wish to display temperatures for all cores [C] or just an average temperature per CPU [a]? (C/a)")
case "$choice" in case "$choiceTempDisplayType" in
# Set temperature search criteria # Set temperature search criteria
[cC] | "") [cC] | "")
if (echo "$sensorsOutput" | grep -A 10 "coretemp-" | grep -q "Core "); then if (echo "$sensorsOutput" | grep -A 10 "coretemp-" | grep -q "Core "); then
@ -224,8 +224,8 @@ function configure {
fi fi
if [ $sensorsDetected = true ]; then if [ $sensorsDetected = true ]; then
TEMP_UNIT=$(ask "Do you wish to display temperatures in degrees Celsius [C] or Fahrenheit [f]? (C/f)") local choiceTempUnit=$(ask "Do you wish to display temperatures in degrees Celsius [C] or Fahrenheit [f]? (C/f)")
case "$TEMP_UNIT" in case "$choiceTempUnit" in
[cC] | "") [cC] | "")
TEMP_UNIT="C" TEMP_UNIT="C"
info "Temperatures will be presented in degrees Celsius." info "Temperatures will be presented in degrees Celsius."
@ -241,8 +241,8 @@ function configure {
esac esac
fi fi
ENABLE_SYS_INFO=$(ask "Do you wish to enable system information? (Y/n)") local choiceEnableSystemInfo=$(ask "Do you wish to enable system information? (Y/n)")
case "$ENABLE_SYS_INFO" in case "$choiceEnableSystemInfo" in
[yY] | "") [yY] | "")
enableSystemInfo=true enableSystemInfo=true
info "System information will be displayed..." info "System information will be displayed..."
@ -829,8 +829,8 @@ function save_sensors_data {
msg "Sensors data will be saved in $filepath" msg "Sensors data will be saved in $filepath"
# Prompt user for confirmation # Prompt user for confirmation
local choice=$(ask "Do you wish to continue? (y/n)") local choiceContinue=$(ask "Do you wish to continue? (y/n)")
case "$choice" in case "$choiceContinue" in
[yY]) [yY])
sensors -j >"$filepath" sensors -j >"$filepath"
msgb "Sensors data saved in $filepath." msgb "Sensors data saved in $filepath."