Remove "?" behind CPU temp. if no core index found in sensors output
This commit is contained in:
parent
f4e7aa4455
commit
6e4daf2ce1
@ -225,10 +225,17 @@ function install_mod {
|
|||||||
try {\n\
|
try {\n\
|
||||||
Object.keys(items[coreKey]).forEach((secondLevelKey) => {\n\
|
Object.keys(items[coreKey]).forEach((secondLevelKey) => {\n\
|
||||||
if (secondLevelKey.includes('_input')) {\n\
|
if (secondLevelKey.includes('_input')) {\n\
|
||||||
|
let tempStr = '';\n\
|
||||||
let temp = items[coreKey][secondLevelKey];\n\
|
let temp = items[coreKey][secondLevelKey];\n\
|
||||||
let index = coreKey.match(/\\\S+\\\s*(\\\d+)/);\n\
|
let index = coreKey.match(/\\\S+\\\s*(\\\d+)/);\n\
|
||||||
index = (index !== null && index.length > 1) ? index[1] : '?';\n\
|
if(index !== null && index.length > 1) {\n\
|
||||||
temps.push(\`\${cpuTempCaption} \${index}: \${temp}°C\`);\n\
|
index = index[1];\n\
|
||||||
|
tempStr = \`\${cpuTempCaption} \${index}: \${temp}°C\`;\n\
|
||||||
|
}\n\
|
||||||
|
else {\n\
|
||||||
|
tempStr = \`\${cpuTempCaption}: \${temp}°C\`;\n\
|
||||||
|
}\n\
|
||||||
|
temps.push(tempStr);\n\
|
||||||
}\n\
|
}\n\
|
||||||
})\n\
|
})\n\
|
||||||
} catch(e) { /*_*/ }\n\
|
} catch(e) { /*_*/ }\n\
|
||||||
@ -412,4 +419,4 @@ done
|
|||||||
# If no arguments were provided or all arguments have been processed, print the usage message
|
# If no arguments were provided or all arguments have been processed, print the usage message
|
||||||
if [[ $executed -eq 0 ]]; then
|
if [[ $executed -eq 0 ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user