New version/tarball. This completes, I think, the line wrap update. -o is now handled,

unmounted drives.

IMPORTANT: some distros use inxi for detecting partitions, the syntax on the following 
have changed slightly:

HDD: per drive changes from: 1: id: to ID-1:
Partitions: per partition changes from ID: to ID-1:
Unmounted partitions: per unmounted changes from ID: to ID-1

You see the pattern, they are all the same now, and they are all numbered. I think this
is easier to read when scanning long lines of drives/partitions, or even short ones.

Also fixed a long standing oddity, not a bug, but for some weird reason, -p did not
include the location, like /dev/sda1, unless -l or -u were used. That makes no sense
so I have moved the dev/remote location output to standard -p/-P

Except for bug fixes, this completes the overally line wrap update, all lines wrap,
you can set widths with -y now, and the old issue of not fitting nicely into 80 column
wide widths is solved. Note that in some areas, p/P for example, at times if the mount
point or remote location is very long the line may still wrap, but making this perfect
is too convoluted so I'm calling it good enough now, all lines are handled reasonably well,
certainly radically better than before 2.1.0.
This commit is contained in:
inxi-svn 2014-04-04 18:16:45 +00:00
parent e500c8a5a0
commit ebca1c219d
2 changed files with 80 additions and 43 deletions

47
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.1.17
#### Date: 2014-04-03
#### Version: 2.1.18
#### Date: 2014-04-04
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -9813,7 +9813,7 @@ print_hard_disk_data()
eval $LOGFS
local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string=''
local hdd_serial=''
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' divisor=5
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name=''
local Line_Starter='Drives:' # inherited by print_optical_drives
# load A_HDD_DATA
get_hdd_data_basic
@ -9861,11 +9861,8 @@ print_hard_disk_data()
hdd_serial='N/A'
fi
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
divisor=1 # print every line
else
divisor=2 # for modulus line print out, either 2 items for full, or default for short
fi
dev_data="${C1}id$SEP3${C2} /dev/${a_hdd_working[0]} "
dev_data="${C1}ID-$((i+1))$SEP3${C2} /dev/${a_hdd_working[0]} "
fi
if [[ -n ${a_hdd_working[2]} ]];then
hdd_name_temp=${a_hdd_working[2]}
@ -9875,9 +9872,8 @@ print_hard_disk_data()
# echo "loop: $i"
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
#hdd_model="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string "
part_1_data="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string "
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
part_1_data="$hdd_model$hdd_string "
if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter" )
@ -10796,8 +10792,6 @@ print_partition_data()
full_fs='N/A' # reset partition fs type
fi
full_fs="${C1}fs$SEP3${C2} $full_fs "
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then
if [[ -n ${a_partition_working[6]} ]];then
if [[ -z $( grep -E '(^//|:/|non-dev)' <<< ${a_partition_working[6]} ) ]];then
part_dev="/dev/${a_partition_working[6]}"
@ -10815,6 +10809,7 @@ print_partition_data()
part_dev='N/A'
fi
full_dev="${C1}$dev_remote$SEP3${C2} $part_dev "
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then
if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then
if [[ -n ${a_partition_working[7]} ]];then
part_label="${a_partition_working[7]}"
@ -10838,7 +10833,7 @@ print_partition_data()
else
partitionIdClean=${a_partition_working[0]}
fi
id_size_fs="${C1}ID$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev"
id_size_fs="${C1}ID-$((i+1))$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev"
label_uuid="$full_label$full_uuid"
# label/uuid always print one per line, so only wrap if it's very long
if [[ $B_SHOW_UUIDS == 'true' || $B_SHOW_LABELS == 'true' ]] && \
@ -11598,15 +11593,17 @@ print_unmounted_partition_data()
local a_unmounted_data='' line_starter='' unmounted_data='' full_fs=''
local full_dev='' full_size='' full_label='' full_uuid='' full_string=''
local bsd_unsupported='This feature is not yet supported for BSD systems.'
local line_starter='Unmounted:' part_2_data=''
if [[ -z ${A_PARTITION_DATA} ]];then
get_partition_data
fi
get_unmounted_partition_data
if [[ ${#A_UNMOUNTED_PARTITION_DATA[@]} -ge 1 ]];then
for (( i=0; i < ${#A_UNMOUNTED_PARTITION_DATA[@]}; i++ ))
do
full_string=''
part_2_data=''
IFS=","
a_unmounted_data=(${A_UNMOUNTED_PARTITION_DATA[i]})
IFS="$ORIGINAL_IFS"
@ -11615,7 +11612,7 @@ print_unmounted_partition_data()
else
full_dev="/dev/${a_unmounted_data[0]}"
fi
full_dev="${C1}ID$SEP3${C2} $full_dev"
full_dev="${C1}ID-$((i+1))$SEP3${C2} $full_dev "
if [[ -z ${a_unmounted_data[1]} ]];then
full_size='N/A'
else
@ -11639,21 +11636,27 @@ print_unmounted_partition_data()
else
full_fs="${C1}fs$SEP3${C2} ${a_unmounted_data[4]} "
fi
full_string="$full_dev $full_size $full_label $full_uuid $full_fs"
if [[ $i -eq 0 ]];then
line_starter='Unmounted:'
else
line_starter=' '
fi
# temporary message to indicate not yet supported
if [[ $BSD_TYPE == 'bsd' ]];then
full_string=$bsd_unsupported
else
full_string="$full_dev$full_size"
part_2_data="$full_fs$full_label$full_uuid"
fi
if [[ $( calculate_line_length "$full_string$part_2_data" ) -gt $COLS_INNER ]];then
unmounted_data=$( create_print_line "$line_starter" "$full_string${CN}" )
print_screen_output "$unmounted_data"
line_starter=' '
unmounted_data=$( create_print_line "$line_starter" "$part_2_data${CN}" )
print_screen_output "$unmounted_data"
else
unmounted_data=$( create_print_line "$line_starter" "$full_string$part_2_data${CN}" )
print_screen_output "$unmounted_data"
line_starter=' '
fi
done
else
unmounted_data=$( create_print_line "Unmounted:" "No unmounted partitions detected${CN}" )
unmounted_data=$( create_print_line "$line_starter" "No unmounted partitions detected${CN}" )
print_screen_output "$unmounted_data"
fi

View file

@ -1,3 +1,37 @@
=====================================================================================
Version: 2.1.18
Patch Version: 00
Script Date: 2014-04-04
-----------------------------------
Changes:
-----------------------------------
New version/tarball. This completes, I think, the line wrap update. -o is now handled,
unmounted drives.
IMPORTANT: some distros use inxi for detecting partitions, the syntax on the following
have changed slightly:
HDD: per drive changes from: 1: id: to ID-1:
Partitions: per partition changes from ID: to ID-1:
Unmounted partitions: per unmounted changes from ID: to ID-1
You see the pattern, they are all the same now, and they are all numbered. I think this
is easier to read when scanning long lines of drives/partitions, or even short ones.
Also fixed a long standing oddity, not a bug, but for some weird reason, -p did not
include the location, like /dev/sda1, unless -l or -u were used. That makes no sense
so I have moved the dev/remote location output to standard -p/-P
Except for bug fixes, this completes the overally line wrap update, all lines wrap,
you can set widths with -y now, and the old issue of not fitting nicely into 80 column
wide widths is solved. Note that in some areas, p/P for example, at times if the mount
point or remote location is very long the line may still wrap, but making this perfect
is too convoluted so I'm calling it good enough now, all lines are handled reasonably well,
certainly radically better than before 2.1.0.
-----------------------------------
-- Harald Hope - Fri, 04 Apr 2014 11:08:25 -0700
=====================================================================================
Version: 2.1.17
Patch Version: 00