mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
branch one, test for esc handling gnu sed vs bsd sed
This commit is contained in:
parent
7cdef2526f
commit
e4a8a76c15
19
inxi
19
inxi
|
@ -2,8 +2,8 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.15
|
#### Version: 2.1.15
|
||||||
#### Date: 2014-04-01
|
#### Date: 2014-04-02
|
||||||
#### Patch Number: 02-b1
|
#### Patch Number: 01-b1
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -521,6 +521,7 @@ C2=''
|
||||||
CN=''
|
CN=''
|
||||||
## Always leave these blank, these are only going to be set in inxi.conf files, that makes testing
|
## Always leave these blank, these are only going to be set in inxi.conf files, that makes testing
|
||||||
## for user changes easier after sourcing the files
|
## for user changes easier after sourcing the files
|
||||||
|
ESC='\x1b'
|
||||||
GLOBAL_COLOR_SCHEME=''
|
GLOBAL_COLOR_SCHEME=''
|
||||||
IRC_COLOR_SCHEME=''
|
IRC_COLOR_SCHEME=''
|
||||||
IRC_CONS_COLOR_SCHEME=''
|
IRC_CONS_COLOR_SCHEME=''
|
||||||
|
@ -825,6 +826,7 @@ initialize_data()
|
||||||
BSD_TYPE='bsd' # all other bsds
|
BSD_TYPE='bsd' # all other bsds
|
||||||
SED_I="-i ''"
|
SED_I="-i ''"
|
||||||
SED_RX='-E'
|
SED_RX='-E'
|
||||||
|
ESC=$(echo | tr '\n' '\033')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# now set the script BOOLEANS for files required to run features
|
# now set the script BOOLEANS for files required to run features
|
||||||
|
@ -8908,11 +8910,12 @@ get_weather_data()
|
||||||
|
|
||||||
# args: $1 - string to strip color code characters out of
|
# args: $1 - string to strip color code characters out of
|
||||||
# returns count of string length minus colors
|
# returns count of string length minus colors
|
||||||
|
# note; this cleanup may not be working on bsd sed
|
||||||
calculate_line_length()
|
calculate_line_length()
|
||||||
{
|
{
|
||||||
local string=$1
|
local string=$1
|
||||||
# ansi: [1;34m irc: \x0312
|
# ansi: [1;34m irc: \x0312
|
||||||
string=$( sed -e "s/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g" -e "s/\\\x0[0-9]\{1,3\}//g" <<< $string )
|
string=$( sed -e 's/'$ESC'\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' -e 's/\\\x0[0-9]\{1,3\}//g' <<< $string )
|
||||||
count=${#string}
|
count=${#string}
|
||||||
echo $count
|
echo $count
|
||||||
}
|
}
|
||||||
|
@ -10526,12 +10529,14 @@ print_networking_ip_data()
|
||||||
if_string=''
|
if_string=''
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ $( calculate_line_length "$if_string_holding$if_string" ) -lt $COLS_INNER ]];then
|
if [[ $( calculate_line_length "$if_string_holding$if_string" ) -gt $COLS_INNER ]];then
|
||||||
if_string_holding="$if_string_holding$if_string"
|
if [[ -n $if_string_holding ]];then
|
||||||
else
|
|
||||||
full_string=$( create_print_line " " "$if_string_holding${CN}" )
|
full_string=$( create_print_line " " "$if_string_holding${CN}" )
|
||||||
print_screen_output "$full_string"
|
print_screen_output "$full_string"
|
||||||
|
fi
|
||||||
if_string_holding="$if_string"
|
if_string_holding="$if_string"
|
||||||
|
else
|
||||||
|
if_string_holding="$if_string_holding$if_string"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
((i++))
|
((i++))
|
||||||
|
@ -10841,8 +10846,10 @@ print_partition_data()
|
||||||
else
|
else
|
||||||
line_starter=' '
|
line_starter=' '
|
||||||
fi
|
fi
|
||||||
|
if [[ -n ${a_partition_data[$i]} ]];then
|
||||||
partition_data=$( create_print_line "$line_starter" "${a_partition_data[$i]}${CN}" )
|
partition_data=$( create_print_line "$line_starter" "${a_partition_data[$i]}${CN}" )
|
||||||
print_screen_output "$partition_data"
|
print_screen_output "$partition_data"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
|
|
Loading…
Reference in a new issue