New version, fixed cpu core speed wrapping, improved -p and -P wrapping, though some

lines
will still be too long, but not as many.
This commit is contained in:
inxi-svn 2014-03-25 01:43:30 +00:00
parent 0115b374a8
commit c1c0752e97
2 changed files with 37 additions and 13 deletions

33
inxi
View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.1.8 #### Version: 2.1.9
#### Date: 2014-03-24 #### Date: 2014-03-24
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
@ -3696,6 +3696,7 @@ get_cpu_data()
} }
print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm
} }
# this is / was used in inxi short output only, but when it is N/A, need to use the previous array # this is / was used in inxi short output only, but when it is N/A, need to use the previous array
# value, from above, the actual speed that is, for short output, key 0. # value, from above, the actual speed that is, for short output, key 0.
if (!min) { if (!min) {
@ -9259,7 +9260,7 @@ print_cpu_data()
local a_cpu_working='' cpu_model='' cpu_clock='' cpu_null_error='' local a_cpu_working='' cpu_model='' cpu_clock='' cpu_null_error=''
local cpc_plural='' cpu_count_print='' model_plural='' cpu_data_string='' local cpc_plural='' cpu_count_print='' model_plural='' cpu_data_string=''
local cpu_physical_count='' cpu_core_count='' cpu_core_alpha='' cpu_type='' local cpu_physical_count='' cpu_core_count='' cpu_core_alpha='' cpu_type=''
local cpu_2_data='' local cpu_2_data='' working_cpu=''
local line_starter='' multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " local line_starter='' multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} "
##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\""
@ -9397,14 +9398,16 @@ print_cpu_data()
#if [[ $i -gt 10 ]];then #if [[ $i -gt 10 ]];then
# break # break
#fi #fi
# echo $(calculate_line_length "$multi_cpu_starter$SEP3 $cpu_multi_clock_data" )
working_cpu="${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz "
if [[ -n $cpu_multi_clock_data && \ if [[ -n $cpu_multi_clock_data && \
$( calculate_line_length "$multi_cpu_starter$cpu_multi_clock_data" ) -gt $COLS_INNER ]];then $( calculate_line_length "$multi_cpu_starter$cpu_multi_clock_data$working_cpu" ) -gt $COLS_INNER ]];then
cpu_multi_clock_data=$( create_print_line " " "$multi_cpu_starter$cpu_multi_clock_data" ) cpu_multi_clock_data=$( create_print_line " " "$multi_cpu_starter$cpu_multi_clock_data" )
print_screen_output "$cpu_multi_clock_data" print_screen_output "$cpu_multi_clock_data"
multi_cpu_starter='' multi_cpu_starter=''
cpu_multi_clock_data="${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz " cpu_multi_clock_data="$working_cpu"
else else
cpu_multi_clock_data="$cpu_multi_clock_data${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz " cpu_multi_clock_data="$cpu_multi_clock_data$working_cpu"
fi fi
done done
fi fi
@ -10557,7 +10560,7 @@ print_partition_data()
local a_partition_working='' partition_used='' partition_data='' local a_partition_working='' partition_used='' partition_data=''
local counter=0 i=0 a_partition_data='' line_starter='' line_max=$(( $COLS_INNER - 25 )) local counter=0 i=0 a_partition_data='' line_starter='' line_max=$(( $COLS_INNER - 25 ))
local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label='' local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label=''
local part_uuid='' full_uuid='' dev_remote='' full_fs='' line_max_label_uuid=$COLS_INNER local part_uuid='' full_uuid='' dev_remote='' full_fs=''
local b_non_dev='false' holder='' local b_non_dev='false' holder=''
# set A_PARTITION_DATA # set A_PARTITION_DATA
@ -10628,17 +10631,25 @@ print_partition_data()
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$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="$full_label$full_uuid"
# label/uuid always print one per line, so only wrap if it's very long # 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_label_uuid ]];then if [[ $B_SHOW_UUIDS == 'true' || $B_SHOW_LABELS == 'true' ]] && \
[[ $( calculate_line_length "${a_partition_data[$counter]}$id_size_fs$label_uuid" ) -gt $COLS_INNER ]];then
a_partition_data[$counter]="$id_size_fs" a_partition_data[$counter]="$id_size_fs"
((counter++)) ((counter++))
a_partition_data[$counter]="$label_uuid" a_partition_data[$counter]="$label_uuid"
else
if [[ $( calculate_line_length "${a_partition_data[$counter]}$id_size_fs$label_uuid" ) -gt $COLS_INNER ]];then
a_partition_data[$counter]="${a_partition_data[$counter]}"
((counter++))
a_partition_data[$counter]="$id_size_fs$label_uuid"
else else
a_partition_data[$counter]="${a_partition_data[$counter]}$id_size_fs$label_uuid" a_partition_data[$counter]="${a_partition_data[$counter]}$id_size_fs$label_uuid"
fi fi
# because these lines can vary widely, using dynamic length handling here
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then
((counter++))
fi fi
((counter++))
# # because these lines can vary widely, using dynamic length handling here
# if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then
# ((counter++))
# fi
fi fi
done done
# print out all lines, line starter on first line # print out all lines, line starter on first line
@ -10784,7 +10795,7 @@ print_raid_data()
chunk_raid_usage='raid allocated' chunk_raid_usage='raid allocated'
else else
no_raid_detected="No RAID data available - $FILE_MDSTAT is missing - is md_mod kernel module loaded?" no_raid_detected="No RAID data available - $FILE_MDSTAT is missing - is md_mod kernel module loaded?"
empty_raid_data="No RAID devices detected - $FILE_MDSTAT and md_mod kernel raid module present" empty_raid_data="No RAID devices detected - $FILE_MDSTAT, md_mod kernel module present"
fi fi
if [[ $BSD_TYPE == 'bsd' ]];then if [[ $BSD_TYPE == 'bsd' ]];then

View file

@ -1,3 +1,16 @@
=====================================================================================
Version: 2.1.9
Patch Version: 00
Script Date: 2014-03-24
-----------------------------------
Changes:
-----------------------------------
New version, fixed cpu core speed wrapping, improved -p and -P wrapping, though some lines
will still be too long, but not as many.
-----------------------------------
-- Harald Hope - Mon, 24 Mar 2014 18:42:06 -0700
===================================================================================== =====================================================================================
Version: 2.1.8 Version: 2.1.8
Patch Version: 00 Patch Version: 00