mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
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:
parent
19c79ecc8d
commit
54c57f3e07
117
inxi
117
inxi
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue