added line wraps for very long partition lines

This commit is contained in:
inxi-svn 2011-07-22 07:46:20 +00:00
parent 9de355d4be
commit cb2301e127

23
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.7.19 #### version: 1.7.20
#### Date: July 22 2011 #### Date: July 22 2011
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
@ -7265,7 +7265,7 @@ print_partition_data()
if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'main' ]];then if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'main' ]];then
if [[ -n ${a_partition_working[2]} ]];then if [[ -n ${a_partition_working[2]} ]];then
partition_used=" ${C1}used$SEP3${C2} ${a_partition_working[2]} (${a_partition_working[3]})" partition_used="${C1}used$SEP3${C2} ${a_partition_working[2]} (${a_partition_working[3]}) "
else else
partition_used='' # reset partition used to null partition_used='' # reset partition used to null
fi fi
@ -7274,7 +7274,7 @@ print_partition_data()
else else
full_fs='N/A' # reset partition used to null full_fs='N/A' # reset partition used to null
fi fi
full_fs=" ${C1}fs$SEP3${C2} $full_fs" full_fs="${C1}fs$SEP3${C2} $full_fs "
# don't show user names in output # don't show user names in output
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then
@ -7290,14 +7290,14 @@ print_partition_data()
dev_remote='dev' dev_remote='dev'
part_dev='N/A' part_dev='N/A'
fi fi
full_dev=" ${C1}$dev_remote$SEP3${C2} $part_dev" full_dev="${C1}$dev_remote$SEP3${C2} $part_dev "
if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then
if [[ -n ${a_partition_working[7]} ]];then if [[ -n ${a_partition_working[7]} ]];then
part_label="${a_partition_working[7]}" part_label="${a_partition_working[7]}"
else else
part_label='N/A' part_label='N/A'
fi fi
full_label=" ${C1}label$SEP3${C2} $part_label" full_label="${C1}label$SEP3${C2} $part_label "
fi fi
if [[ $B_SHOW_UUIDS == 'true' && $dev_remote != 'remote' ]];then if [[ $B_SHOW_UUIDS == 'true' && $dev_remote != 'remote' ]];then
if [[ -n ${a_partition_working[8]} ]];then if [[ -n ${a_partition_working[8]} ]];then
@ -7305,7 +7305,7 @@ print_partition_data()
else else
part_uuid='N/A' part_uuid='N/A'
fi fi
full_uuid=" ${C1}uuid$SEP3${C2} $part_uuid" full_uuid="${C1}uuid$SEP3${C2} $part_uuid"
fi fi
fi fi
if [[ $B_OUTPUT_FILTER == 'true' ]];then if [[ $B_OUTPUT_FILTER == 'true' ]];then
@ -7313,8 +7313,17 @@ print_partition_data()
else else
partitionIdClean=${a_partition_working[0]} partitionIdClean=${a_partition_working[0]}
fi fi
id_size_fs="${C1}ID:${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' && $( calculate_line_length "$id_size_fs$label_uuid" ) -gt $LINE_MAX ]];then
a_partition_data[$counter]="$id_size_fs"
((counter++))
a_partition_data[$counter]="$label_uuid"
else
a_partition_data[$counter]="${a_partition_data[$counter]}$id_size_fs$label_uuid"
fi
# because these lines can vary widely, using dynamic length handling here # because these lines can vary widely, using dynamic length handling here
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]}$partition_used$full_fs$full_dev$full_label$full_uuid "
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then
((counter++)) ((counter++))
fi fi