chore: shorten cpu
9b651ff8
1 file(s) · +6 −1
| 45 | 45 | if (isLinux) { |
|
| 46 | 46 | const cpuInfo = await $`grep "model name" /proc/cpuinfo`.text(); |
|
| 47 | 47 | const firstCpu = cpuInfo.split("\n")[0]; |
|
| 48 | - | const cpuBrand = firstCpu.split(":")[1]?.trim() || "Unknown"; |
|
| 48 | + | let cpuBrand = firstCpu.split(":")[1]?.trim() || "Unknown"; |
|
| 49 | + | // Shorten common CPU names |
|
| 50 | + | cpuBrand = cpuBrand.replace(/ w\/ Radeon.*$/i, ""); // Remove Radeon graphics info |
|
| 51 | + | cpuBrand = cpuBrand.replace(/ with Radeon.*$/i, ""); |
|
| 52 | + | cpuBrand = cpuBrand.replace(/\(TM\)/g, "").replace(/\(R\)/g, ""); // Remove trademark symbols |
|
| 53 | + | cpuBrand = cpuBrand.replace(/\s+/g, " ").trim(); // Clean up extra spaces |
|
| 49 | 54 | stats.cpu = cpuBrand; |
|
| 50 | 55 | } else { |
|
| 51 | 56 | const cpuBrand = await $`sysctl -n machdep.cpu.brand_string`.text(); |