From cb2301e127d96de60ca15686e0c9dd2b49726559 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 22 Jul 2011 07:46:20 +0000 Subject: [PATCH] added line wraps for very long partition lines --- inxi | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/inxi b/inxi index fbe1a57..9127ea9 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.7.19 +#### version: 1.7.20 #### Date: July 22 2011 #### Patch Number: 00 ######################################################################## @@ -7265,7 +7265,7 @@ print_partition_data() if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'main' ]];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 partition_used='' # reset partition used to null fi @@ -7274,7 +7274,7 @@ print_partition_data() else full_fs='N/A' # reset partition used to null fi - full_fs=" ${C1}fs$SEP3${C2} $full_fs" + full_fs="${C1}fs$SEP3${C2} $full_fs " # don't show user names in output if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then @@ -7290,14 +7290,14 @@ print_partition_data() dev_remote='dev' part_dev='N/A' 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 [[ -n ${a_partition_working[7]} ]];then part_label="${a_partition_working[7]}" else part_label='N/A' fi - full_label=" ${C1}label$SEP3${C2} $part_label" + full_label="${C1}label$SEP3${C2} $part_label " fi if [[ $B_SHOW_UUIDS == 'true' && $dev_remote != 'remote' ]];then if [[ -n ${a_partition_working[8]} ]];then @@ -7305,7 +7305,7 @@ print_partition_data() else part_uuid='N/A' fi - full_uuid=" ${C1}uuid$SEP3${C2} $part_uuid" + full_uuid="${C1}uuid$SEP3${C2} $part_uuid" fi fi if [[ $B_OUTPUT_FILTER == 'true' ]];then @@ -7313,8 +7313,17 @@ print_partition_data() else partitionIdClean=${a_partition_working[0]} 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 - 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 ((counter++)) fi