mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 00:47:47 +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
109
inxi
109
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### Version: 2.3.3
|
||||
#### Date: 2016-10-25
|
||||
#### Version: 2.3.4
|
||||
#### Date: 2016-11-03
|
||||
#### Patch Number: 00
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -12761,7 +12761,7 @@ print_hard_disk_data()
|
|||
hdd_temp_data=${a_hdd_working[5]}
|
||||
# error handling is done in get data function
|
||||
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
|
||||
hdd_temp_data=''
|
||||
fi
|
||||
|
@ -12771,7 +12771,7 @@ print_hard_disk_data()
|
|||
if [[ -z $hdd_serial ]];then
|
||||
hdd_serial='N/A'
|
||||
fi
|
||||
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
|
||||
hdd_serial="${C1}serial$SEP3${C2} $hdd_serial "
|
||||
fi
|
||||
dev_data="$dev_string${a_hdd_working[0]} "
|
||||
fi
|
||||
|
@ -12782,61 +12782,90 @@ print_hard_disk_data()
|
|||
fi
|
||||
# echo "loop: $i"
|
||||
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_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 [[ $( 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" )
|
||||
print_screen_output "$hdd_data"
|
||||
#echo 0
|
||||
Line_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" )
|
||||
print_screen_output "$hdd_data"
|
||||
part_1_data=''
|
||||
#echo 1
|
||||
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" "$row_starter$part_1_data" )
|
||||
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data$part_2_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=''
|
||||
#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
|
||||
part_2_data=$part_1_data
|
||||
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
|
||||
# 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
|
||||
else
|
||||
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
|
||||
Patch Version: 00
|
||||
|
|
Loading…
Reference in a new issue