fix(core): tidy formatting and minor fixes across CLI, SNMP, HTTP server, migrations and packaging

This commit is contained in:
2026-01-29 17:10:17 +00:00
parent fda072d15e
commit ff2dc00f31
31 changed files with 693 additions and 362 deletions

View File

@@ -5,8 +5,8 @@
* Run with: deno run --allow-all test/showcase.ts
*/
import { logger, type ITableColumn } from '../ts/logger.ts';
import { theme, symbols, getBatteryColor, formatPowerStatus } from '../ts/colors.ts';
import { type ITableColumn, logger } from '../ts/logger.ts';
import { formatPowerStatus, getBatteryColor, symbols, theme } from '../ts/colors.ts';
console.log('');
console.log('═'.repeat(80));
@@ -38,31 +38,51 @@ logger.logBoxEnd();
console.log('');
logger.logBox('Success Box (Green)', [
'Used for successful operations',
'Installation complete, service started, etc.',
], 60, 'success');
logger.logBox(
'Success Box (Green)',
[
'Used for successful operations',
'Installation complete, service started, etc.',
],
60,
'success',
);
console.log('');
logger.logBox('Error Box (Red)', [
'Used for critical errors and failures',
'Configuration errors, connection failures, etc.',
], 60, 'error');
logger.logBox(
'Error Box (Red)',
[
'Used for critical errors and failures',
'Configuration errors, connection failures, etc.',
],
60,
'error',
);
console.log('');
logger.logBox('Warning Box (Yellow)', [
'Used for warnings and deprecations',
'Old command format, missing config, etc.',
], 60, 'warning');
logger.logBox(
'Warning Box (Yellow)',
[
'Used for warnings and deprecations',
'Old command format, missing config, etc.',
],
60,
'warning',
);
console.log('');
logger.logBox('Info Box (Cyan)', [
'Used for informational messages',
'Version info, update available, etc.',
], 60, 'info');
logger.logBox(
'Info Box (Cyan)',
[
'Used for informational messages',
'Version info, update available, etc.',
],
60,
'info',
);
console.log('');
@@ -112,15 +132,24 @@ const upsColumns: ITableColumn[] = [
{ header: 'ID', key: 'id' },
{ header: 'Name', key: 'name' },
{ header: 'Host', key: 'host' },
{ header: 'Status', key: 'status', color: (v) => {
if (v.includes('Online')) return theme.success(v);
if (v.includes('Battery')) return theme.warning(v);
return theme.dim(v);
}},
{ header: 'Battery', key: 'battery', align: 'right', color: (v) => {
const pct = parseInt(v);
return getBatteryColor(pct)(v);
}},
{
header: 'Status',
key: 'status',
color: (v) => {
if (v.includes('Online')) return theme.success(v);
if (v.includes('Battery')) return theme.warning(v);
return theme.dim(v);
},
},
{
header: 'Battery',
key: 'battery',
align: 'right',
color: (v) => {
const pct = parseInt(v);
return getBatteryColor(pct)(v);
},
},
{ header: 'Runtime', key: 'runtime', align: 'right' },
];