export class CliFlow { protected moduleName: string; constructor(moduleName: string) { this.moduleName = moduleName; } /** * showHeader */ public showHeader(title: string, subtitle?: string) { const LENGTH = Math.max(title.length, subtitle?.length ?? 0) + 5; // Chars: ╔═╗║╚═╝╬ // Draw the top border let topStr = "╔"; for (let i = 0; i < LENGTH; i++) { topStr += "═"; } topStr += "╗"; console.log(topStr); // Draw the title console.log(`║ \x1B[33;1m${title}\x1B[0m ${"║".padStart(LENGTH - title.length - 1, " ")}`); // Draw the subtitle subtitle && console.log(`║ \x1B[2m${subtitle}\x1B[0m ${"║".padStart(LENGTH - subtitle.length - 1, " ")}`); // Draw the bottom border let btmStr = "╚"; for (let i = 0; i < LENGTH; i++) { btmStr += "═"; } btmStr += "╝"; console.log(btmStr + "\n"); } log(...msg: string[]) { console.log(`\t\x1B[33m[LOG]\x1B[0m ${msg.join(" ")}`); } }