npx systeminformation improved output

This commit is contained in:
Sebastian Hildebrandt 2025-12-31 07:12:28 +01:00
parent 158b579527
commit 520f05d7db
4 changed files with 29 additions and 14 deletions

View File

@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.28.6 | 2025-12-31 | `npx systeminformation` improved output |
| 5.28.5 | 2025-12-30 | `cpuCurrentSpeed()` fix cpu loop issue |
| 5.28.4 | 2025-12-29 | `powerShell()` Windows 7 fix compatibility issues (windows) |
| 5.28.3 | 2025-12-28 | `processes()`, `processLoad()` fix command line parsing (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.28.6</th>
<td>2025-12-31</td>
<td><span class="code">npx systeminformation</span> improved output</td>
</tr>
<tr>
<th scope="row">5.28.5</th>
<td>2025-12-30</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.28.5</span></div>
<div class="version">New Version: <span id="version">5.28.6</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -23,19 +23,31 @@ function capFirst(string) {
return string[0].toUpperCase() + string.slice(1);
}
function getValue(value) {
if (value === null || value === undefined) {
return '';
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
return value.toString();
}
function printLines(obj) {
for (const property in obj) {
console.log(capFirst(property) + ' '.substring(0, 17 - property.length) + ': ' + (obj[property] || ''));
console.log(`${capFirst(property) + ' '.substring(0, 17 - property.length)}: ${getValue(obj[property])}`);
}
console.log();
}
function info() {
console.log('┌─────────────────────────────────────────────────────────────────────────────────────────┐');
console.log('│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length) + 'Version: ' + lib_version + ' │');
console.log(
`${'│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length)}Version: ${lib_version}`
);
console.log('└─────────────────────────────────────────────────────────────────────────────────────────┘');
si.osInfo().then(res => {
si.osInfo().then((res) => {
console.log();
console.log('Operating System:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
@ -45,7 +57,7 @@ function info() {
delete res.fqdn;
delete res.uefi;
printLines(res);
si.system().then(res => {
si.system().then((res) => {
console.log('System:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
delete res.serial;
@ -53,7 +65,7 @@ function info() {
delete res.sku;
delete res.uuid;
printLines(res);
si.cpu().then(res => {
si.cpu().then((res) => {
console.log('CPU:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
delete res.cache;
@ -74,18 +86,15 @@ function info() {
// ----------------------------------------------------------------------------------
// Main
// ----------------------------------------------------------------------------------
(function () {
(() => {
const args = process.argv.slice(2);
if (args[0] === 'info') {
info();
} else {
si.getStaticData().then(
((data) => {
data.time = si.time();
console.log(JSON.stringify(data, null, 2));
}
));
si.getStaticData().then((data) => {
data.time = si.time();
console.log(JSON.stringify(data, null, 2));
});
}
})();