fix(cli, systemd): Adjust log formatting for consistent output in CLI and systemd commands

This commit is contained in:
2025-03-26 18:08:43 +00:00
parent 9859a02ea2
commit 459911fe5f
4 changed files with 13 additions and 7 deletions

View File

@ -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'
}

View File

@ -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

View File

@ -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