fix(sensors): numeric parser anchors on degree symbol (label-digit bug) [#618]
This commit is contained in:
@@ -50,7 +50,7 @@ numeric_pick() {
|
||||
[[ "$pick" =~ $num_re ]] && { printf '%s\n' "$pick"; return 0; }
|
||||
done
|
||||
if [[ -n "$native" ]]; then
|
||||
pick="$(grep -oE '\-?[0-9]+(\.[0-9]+)?' <<<"$native" | head -1)"
|
||||
pick="$(grep -oE "\-?[0-9]+(\.[0-9]+)?°C" <<<"$native" | head -1)"; pick="${pick%°C}"
|
||||
[[ "$pick" =~ $num_re ]] && { printf '%s\n' "$pick"; return 0; }
|
||||
fi
|
||||
return 1
|
||||
|
||||
@@ -35,7 +35,7 @@ test_numeric_falls_back_internal() {
|
||||
}
|
||||
|
||||
test_numeric_uses_first_line_value() {
|
||||
if [[ "$(numeric_pick "" "" "+27.5°C")" == "27.5" ]]; then
|
||||
if [[ "$(numeric_pick "" "" "temp1: +27.5°C (high = +84.0°C)")" == "27.5" ]]; then
|
||||
echo "✅ numeric_pick parses first native temp"
|
||||
else
|
||||
echo "❌ numeric_pick native parse broken: got '$(numeric_pick "" "" "+27.5°C")'"
|
||||
|
||||
Reference in New Issue
Block a user