style: refine version info display format and clean up whoami
This commit is contained in:
@@ -211,13 +211,21 @@ class VersionCommand {
|
|||||||
const M = parsed.time.substring(2, 4);
|
const M = parsed.time.substring(2, 4);
|
||||||
const dateObj = new Date(`${y}-${m}-${d}T${H}:${M}:00`);
|
const dateObj = new Date(`${y}-${m}-${d}T${H}:${M}:00`);
|
||||||
|
|
||||||
|
// 12-hour format logic
|
||||||
|
let hour = parseInt(H);
|
||||||
|
const ampm = hour >= 12 ? 'PM' : 'AM';
|
||||||
|
hour = hour % 12;
|
||||||
|
hour = hour ? hour : 12; // the hour '0' should be '12'
|
||||||
|
const time12 = `${hour}:${M} ${ampm}`;
|
||||||
|
|
||||||
console.log(color.bold('\nS4 Version Analysis:'));
|
console.log(color.bold('\nS4 Version Analysis:'));
|
||||||
console.log(`Major: ${parsed.major}`);
|
console.log(`Major: ${parsed.major}`);
|
||||||
console.log(`Minor: ${parsed.minor}`);
|
console.log(`Minor: ${parsed.minor}`);
|
||||||
console.log(`Patch: ${parsed.patch}`);
|
console.log(`Patch: ${parsed.patch}`);
|
||||||
console.log(`Stage: ${color.magenta(parsed.stage)}`);
|
console.log(`Stage: ${color.magenta(parsed.stage)}`);
|
||||||
console.log(`Build: ${parsed.build}`);
|
console.log(`Build: ${parsed.build}`);
|
||||||
console.log(`Time: ${dateObj.toDateString()} @ ${H}:${M}`);
|
console.log(`Date: ${dateObj.toDateString()}`);
|
||||||
|
console.log(`Time: ${time12} (${H}:${M})`);
|
||||||
console.log(`Git: ${parsed.branch} (${parsed.commit})`);
|
console.log(`Git: ${parsed.branch} (${parsed.commit})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,22 +37,8 @@ class WhoAmICommand {
|
|||||||
console.log(`├─ Name: ${color.cyan(gitUser)}`);
|
console.log(`├─ Name: ${color.cyan(gitUser)}`);
|
||||||
console.log(`└─ Email: ${color.cyan(gitEmail)}`);
|
console.log(`└─ Email: ${color.cyan(gitEmail)}`);
|
||||||
|
|
||||||
// Parse S4 date/time if available
|
|
||||||
let builtAt = 'unknown';
|
|
||||||
const parsed = S4Versioning.parse(version);
|
|
||||||
if (parsed) {
|
|
||||||
const y = parsed.date.substring(0, 4);
|
|
||||||
const m = parsed.date.substring(4, 6);
|
|
||||||
const d = parsed.date.substring(6, 8);
|
|
||||||
const H = parsed.time.substring(0, 2);
|
|
||||||
const M = parsed.time.substring(2, 4);
|
|
||||||
const dateObj = new Date(`${y}-${m}-${d}T${H}:${M}:00`);
|
|
||||||
builtAt = `${dateObj.toDateString()} @ ${H}:${M}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`\n${color.green('TOOL_METRICS')}`);
|
console.log(`\n${color.green('TOOL_METRICS')}`);
|
||||||
console.log(`├─ Version: ${color.magenta(version)}`);
|
console.log(`├─ Version: ${color.magenta(version)}`);
|
||||||
console.log(`├─ Built: ${builtAt}`);
|
|
||||||
console.log(`├─ Engine: Node ${process.version}`);
|
console.log(`├─ Engine: Node ${process.version}`);
|
||||||
console.log(`└─ Author: ${pkg.author}`);
|
console.log(`└─ Author: ${pkg.author}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user