@ordino.ai/cli
Version:
ordino.ai global command line interface
22 lines (19 loc) • 714 B
text/typescript
function printMessage(
message: string,
color: string = "32",
isBold: boolean = false,
center: boolean = false
): void {
const consoleWidth: number = process.stdout.columns || 80;
const formattedMessage: string = center
? " ".repeat(Math.floor((consoleWidth - message.length) / 2)) + message
: message;
const boldCode: string = isBold ? "\x1b[1m" : "";
const colorCode: string = `\x1b[${color}m`;
console.log(`${boldCode}${colorCode}${formattedMessage}\x1b[0m`);
}
function printAsciiArt(art: string, center: boolean = false): void {
const lines: string[] = art.split("\n");
lines.forEach((line) => printMessage(line, "32", true, center));
}
export { printAsciiArt, printMessage };