From 459911fe5fb30ba6b98bb48133935dc5a8124b09 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 26 Mar 2025 18:08:43 +0000 Subject: [PATCH] fix(cli, systemd): Adjust log formatting for consistent output in CLI and systemd commands --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/cli.ts | 4 ++-- ts/systemd.ts | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index e3351f2..452d859 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-03-26 - 2.6.11 - fix(cli, systemd) +Adjust log formatting for consistent output in CLI and systemd commands + +- Fixed spacing issues in service installation and status log messages in the systemd module. +- Revised output formatting in the CLI to improve message clarity. + ## 2025-03-26 - 2.6.10 - fix(daemon) Adjust console log box formatting for consistent output in daemon status messages diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 541254c..d236ec9 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/nupst', - version: '2.6.10', + version: '2.6.11', description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices' } diff --git a/ts/cli.ts b/ts/cli.ts index a51229b..315e3a4 100644 --- a/ts/cli.ts +++ b/ts/cli.ts @@ -919,7 +919,7 @@ Options: if (isActive) { // Service is running, restart it - console.log('┌─ Service Update ─────────────────────────┐'); + console.log('┌─ Service Update ──────────────────────────┐'); console.log('│ Configuration has changed.'); console.log('│ Restarting NUPST service to apply changes...'); @@ -939,7 +939,7 @@ Options: console.log('│ sudo systemctl restart nupst.service'); } - console.log('└──────────────────────────────────────────┘'); + console.log('└───────────────────────────────────────────┘'); } } catch (error) { // Ignore errors checking service status diff --git a/ts/systemd.ts b/ts/systemd.ts index ff8c0d1..d3cc9f2 100644 --- a/ts/systemd.ts +++ b/ts/systemd.ts @@ -66,7 +66,7 @@ WantedBy=multi-user.target // Write the service file await fs.writeFile(this.serviceFilePath, this.serviceTemplate); - console.log('┌─ Service Installation ─────────────────────┐'); + console.log('┌─ Service Installation ──────────────────────┐'); console.log(`│ Service file created at ${this.serviceFilePath}`); // Reload systemd daemon @@ -76,7 +76,7 @@ WantedBy=multi-user.target // Enable the service execSync('systemctl enable nupst.service'); console.log('│ Service enabled to start on boot'); - console.log('└──────────────────────────────────────────┘'); + console.log('└─────────────────────────────────────────────┘'); } catch (error) { if (error.message === 'Configuration not found') { // Just rethrow the error as the message has already been displayed @@ -97,9 +97,9 @@ WantedBy=multi-user.target await this.checkConfigExists(); execSync('systemctl start nupst.service'); - console.log('┌─ Service Status ─────────────────────────┐'); + console.log('┌─ Service Status ───────────────────────────┐'); console.log('│ NUPST service started successfully'); - console.log('└──────────────────────────────────────────┘'); + console.log('└────────────────────────────────────────────┘'); } catch (error) { if (error.message === 'Configuration not found') { // Exit with error code since configuration is required