style: improve date formatting in version info and whoami output
This commit is contained in:
@@ -203,13 +203,21 @@ class VersionCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format date/time
|
||||||
|
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`);
|
||||||
|
|
||||||
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: ${parsed.date} @ ${parsed.time}`);
|
console.log(`Time: ${dateObj.toDateString()} @ ${H}:${M}`);
|
||||||
console.log(`Git: ${parsed.branch} (${parsed.commit})`);
|
console.log(`Git: ${parsed.branch} (${parsed.commit})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,22 @@ 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