Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
d14ba1dd65 | |||
7d595fa175 | |||
df417432b0 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@serve.zone/nupst",
|
||||
"version": "4.1.2",
|
||||
"version": "4.1.4",
|
||||
"exports": "./mod.ts",
|
||||
"tasks": {
|
||||
"dev": "deno run --allow-all mod.ts",
|
||||
|
@@ -6,5 +6,5 @@ import denoConfig from '../deno.json' with { type: 'json' };
|
||||
export const commitinfo = {
|
||||
name: denoConfig.name,
|
||||
version: denoConfig.version,
|
||||
description: 'Deno-powered UPS monitoring tool for SNMP-enabled UPS devices',
|
||||
description: 'Network UPS Shutdown Tool (https://nupst.serve.zone)',
|
||||
};
|
||||
|
@@ -469,7 +469,7 @@ export class NupstCli {
|
||||
private showVersion(): void {
|
||||
const version = this.nupst.getVersion();
|
||||
logger.log(`NUPST version ${version}`);
|
||||
logger.log('Deno-powered UPS monitoring tool');
|
||||
logger.log('Network UPS Shutdown Tool (https://nupst.serve.zone)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -134,6 +134,45 @@ WantedBy=multi-user.target
|
||||
* Get status of the systemd service and UPS
|
||||
* @param debugMode Whether to enable debug mode for SNMP
|
||||
*/
|
||||
/**
|
||||
* Display version information and update status
|
||||
* @private
|
||||
*/
|
||||
private async displayVersionInfo(): Promise<void> {
|
||||
try {
|
||||
const nupst = this.daemon.getNupstSnmp().getNupst();
|
||||
const version = nupst.getVersion();
|
||||
|
||||
// Check for updates
|
||||
const updateAvailable = await nupst.checkForUpdates();
|
||||
|
||||
// Display version info
|
||||
if (updateAvailable) {
|
||||
const updateStatus = nupst.getUpdateStatus();
|
||||
logger.log('');
|
||||
logger.log(
|
||||
`${theme.dim('NUPST')} ${theme.dim('v' + version)} ${symbols.warning} ${theme.statusWarning(`Update available: v${updateStatus.latestVersion}`)}`,
|
||||
);
|
||||
logger.log(` ${theme.dim('Run')} ${theme.command('sudo nupst update')} ${theme.dim('to upgrade')}`);
|
||||
} else {
|
||||
logger.log('');
|
||||
logger.log(
|
||||
`${theme.dim('NUPST')} ${theme.dim('v' + version)} ${symbols.success} ${theme.success('Up to date')}`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
// If version check fails, show at least the current version
|
||||
try {
|
||||
const nupst = this.daemon.getNupstSnmp().getNupst();
|
||||
const version = nupst.getVersion();
|
||||
logger.log('');
|
||||
logger.log(`${theme.dim('NUPST')} ${theme.dim('v' + version)}`);
|
||||
} catch (_innerError) {
|
||||
// Silently fail if we can't even get the version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async getStatus(debugMode: boolean = false): Promise<void> {
|
||||
try {
|
||||
// Enable debug mode if requested
|
||||
@@ -144,7 +183,10 @@ WantedBy=multi-user.target
|
||||
this.daemon.getNupstSnmp().enableDebug();
|
||||
}
|
||||
|
||||
// Check if config exists first
|
||||
// Display version and update status first
|
||||
await this.displayVersionInfo();
|
||||
|
||||
// Check if config exists
|
||||
try {
|
||||
await this.checkConfigExists();
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user