| 5.28.5 |
2025-12-30 |
diff --git a/docs/index.html b/docs/index.html
index 43d039a..ea457ed 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.28.5
+ New Version: 5.28.6
diff --git a/lib/cli.js b/lib/cli.js
index cfccb95..f5d0e8d 100755
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -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));
+ });
}
-
})();