mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
logic cleanup in printout function for hdd data
This commit is contained in:
parent
2229da51b6
commit
3a91faffee
39
inxi
39
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.1.12
|
#### version: 1.1.13
|
||||||
#### Date: August 6 2009
|
#### Date: August 6 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -3945,7 +3945,7 @@ print_hard_disk_data()
|
||||||
local hdd_capacity=${a_hdd_basic_working[0]}
|
local hdd_capacity=${a_hdd_basic_working[0]}
|
||||||
local hdd_used=${a_hdd_basic_working[1]}
|
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
|
## note: the output part of this should be in the print hdd data function, not here
|
||||||
get_hard_drive_data_advanced
|
get_hard_drive_data_advanced
|
||||||
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
|
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
|
divisor=2 # for modulus line print out, either 2 items for full, or default for short
|
||||||
fi
|
fi
|
||||||
hdd_name="${a_hdd_working[2]}"
|
hdd_name="${a_hdd_working[2]}"
|
||||||
|
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data"
|
||||||
if [[ $B_SHOW_DISK == 'true' || $VERBOSITY_LEVEL -ge 3 ]];then
|
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
|
||||||
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data"
|
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
|
||||||
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
|
case $i in
|
||||||
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
|
0)
|
||||||
case $i in
|
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
|
||||||
0)
|
print_screen_output "$hdd_data"
|
||||||
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
|
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"
|
print_screen_output "$hdd_data"
|
||||||
hdd_model=''
|
hdd_model=''
|
||||||
;;
|
fi
|
||||||
*)
|
;;
|
||||||
# using modulus here, if divisible by $divisor, print line, otherwise skip
|
esac
|
||||||
if [[ $(( $i % $divisor )) -eq 0 ]];then
|
|
||||||
hdd_data=$( create_print_line " " "${hdd_model}${CN}" )
|
|
||||||
print_screen_output "$hdd_data"
|
|
||||||
hdd_model=''
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
# then print any leftover items
|
# then print any leftover items
|
||||||
if [[ -n $hdd_model ]];then
|
if [[ -n $hdd_model ]];then
|
||||||
|
|
Loading…
Reference in a new issue