logic cleanup in printout function for hdd data

This commit is contained in:
inxi-svn 2009-08-07 00:51:10 +00:00
parent 2229da51b6
commit 3a91faffee

39
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.1.12
#### version: 1.1.13
#### Date: August 6 2009
########################################################################
#### SPECIAL THANKS
@ -3945,7 +3945,7 @@ print_hard_disk_data()
local hdd_capacity=${a_hdd_basic_working[0]}
local hdd_used=${a_hdd_basic_working[1]}
if [[ $VERBOSITY_LEVEL -ge 3 ]] || [[ $B_SHOW_DISK == 'true' ]];then
if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_DISK == 'true' ]];then
## note: the output part of this should be in the print hdd data function, not here
get_hard_drive_data_advanced
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
@ -3974,27 +3974,24 @@ print_hard_disk_data()
divisor=2 # for modulus line print out, either 2 items for full, or default for short
fi
hdd_name="${a_hdd_working[2]}"
if [[ $B_SHOW_DISK == 'true' || $VERBOSITY_LEVEL -ge 3 ]];then
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data"
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
case $i in
0)
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data"
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
case $i in
0)
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
print_screen_output "$hdd_data"
hdd_model=''
;;
*)
# using modulus here, if divisible by $divisor, print line, otherwise skip
if [[ $(( $i % $divisor )) -eq 0 ]];then
hdd_data=$( create_print_line " " "${hdd_model}${CN}" )
print_screen_output "$hdd_data"
hdd_model=''
;;
*)
# using modulus here, if divisible by $divisor, print line, otherwise skip
if [[ $(( $i % $divisor )) -eq 0 ]];then
hdd_data=$( create_print_line " " "${hdd_model}${CN}" )
print_screen_output "$hdd_data"
hdd_model=''
fi
;;
esac
fi
fi
;;
esac
done
# then print any leftover items
if [[ -n $hdd_model ]];then