New version, new tarball. This improves -D output, now capacity is on its own line, and

each disk is on its own line always, this makes it easier to read and/or parse.

Also, the lines now wrap nicely for extra data > console width, or -y 80 for example if
you're trying to force most of the data to fit into 80 columns.
This commit is contained in:
Harald Hope 2016-11-03 19:44:48 -07:00
parent 19c79ecc8d
commit 54c57f3e07
2 changed files with 85 additions and 40 deletions

121
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.3.3 #### Version: 2.3.4
#### Date: 2016-10-25 #### Date: 2016-11-03
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -12761,7 +12761,7 @@ print_hard_disk_data()
hdd_temp_data=${a_hdd_working[5]} hdd_temp_data=${a_hdd_working[5]}
# error handling is done in get data function # error handling is done in get data function
if [[ -n $hdd_temp_data ]];then if [[ -n $hdd_temp_data ]];then
hdd_temp_data=" ${C1}temp$SEP3${C2} ${hdd_temp_data}C" hdd_temp_data="${C1}temp$SEP3${C2} ${hdd_temp_data}C "
else else
hdd_temp_data='' hdd_temp_data=''
fi fi
@ -12771,7 +12771,7 @@ print_hard_disk_data()
if [[ -z $hdd_serial ]];then if [[ -z $hdd_serial ]];then
hdd_serial='N/A' hdd_serial='N/A'
fi fi
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial" hdd_serial="${C1}serial$SEP3${C2} $hdd_serial "
fi fi
dev_data="$dev_string${a_hdd_working[0]} " dev_data="$dev_string${a_hdd_working[0]} "
fi fi
@ -12782,61 +12782,90 @@ print_hard_disk_data()
fi fi
# echo "loop: $i" # echo "loop: $i"
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp" hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
hdd_string="${C1}ID-$((i+1))$SEP3${C2} $usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data" hdd_string="${C1}ID-$((i+1))$SEP3${C2} $usb_data$dev_data$hdd_name$size_data"
part_1_data="$hdd_model$hdd_string " part_1_data="$hdd_model$hdd_string "
part_2_data="$hdd_serial$hdd_temp_data"
## Forcing the capacity to print on its own row, and the first drive on its own
## then each disk prints on its own line, or two lines, depending on console/output width
if [[ $i -eq 0 ]];then if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then #if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt 80 ]];then
if [[ -n $row_starter ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter" ) hdd_data=$( create_print_line "$Line_Starter" "$row_starter" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
#echo 0 #echo 0
Line_Starter=' ' Line_Starter=' '
row_starter='' row_starter=''
fi
if [[ $( calculate_line_length "$part_1_data$part_2_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" ) hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
part_1_data='' part_1_data=''
#echo 1
else
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
Line_Starter=' '
row_starter=''
part_1_data=''
#echo 2
fi
fi
if [[ $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then
if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_2_data ) ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_2_data=''
fi
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 4
elif [[ -n $part_2_data && \
$( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data$part_1_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_1_data=''
part_2_data=''
else
part_2_data=$part_1_data
fi
done
# then print any leftover items
if [[ -n $part_2_data ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" ) hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
#echo 5 part_2_data=''
else
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data$part_2_data" )
print_screen_output "$hdd_data"
part_1_data=''
part_2_data=''
fi fi
#echo 1
#else
# hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
# print_screen_output "$hdd_data"
# Line_Starter=' '
# row_starter=''
# part_1_data=''
#echo 2
#fi
else
if [[ $( calculate_line_length "$part_1_data$part_2_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
print_screen_output "$hdd_data"
part_2_data=''
else
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data$part_2_data" )
print_screen_output "$hdd_data"
part_1_data=''
part_2_data=''
fi
fi
# if [[ $( calculate_line_length "$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then
# if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_2_data ) ]];then
# hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
# print_screen_output "$hdd_data"
# #echo 3
# Line_Starter=' '
# #row_starter=''
# part_2_data=''
# fi
# hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
# print_screen_output "$hdd_data"
# part_1_data=''
# #echo 4
# elif [[ -n $part_2_data && \
# $( calculate_line_length "$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
# hdd_data=$( create_print_line "$Line_Starter" "$part_2_data$part_1_data" )
# print_screen_output "$hdd_data"
# #echo 3
# Line_Starter=' '
# #row_starter=''
# part_1_data=''
# part_2_data=''
# else
# part_2_data=$part_1_data
# fi
done
# then print any leftover items
# if [[ -n $part_2_data ]];then
# hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
# print_screen_output "$hdd_data"
# #echo 5
# fi
fi fi
else else
hdd_data="$row_starter" hdd_data="$row_starter"

View file

@ -1,3 +1,19 @@
=====================================================================================
Version: 2.3.4
Patch Version: 00
Script Date: 2016-11-03
-----------------------------------
Changes:
-----------------------------------
New version, new tarball. This improves -D output, now capacity is on its own line, and
each disk is on its own line always, this makes it easier to read and/or parse.
Also, the lines now wrap nicely for extra data > console width, or -y 80 for example if
you're trying to force most of the data to fit into 80 columns.
-----------------------------------
-- Harald Hope - Thu, 03 Nov 2016 19:39:15 -0700
===================================================================================== =====================================================================================
Version: 2.3.3 Version: 2.3.3
Patch Version: 00 Patch Version: 00