style: configure deno fmt to use single quotes
- Add singleQuote: true to deno.json fmt configuration - Reformat all files with single quotes using deno fmt
This commit is contained in:
24
ts/logger.ts
24
ts/logger.ts
@@ -5,7 +5,7 @@
|
||||
export class Logger {
|
||||
private currentBoxWidth: number | null = null;
|
||||
private static instance: Logger;
|
||||
|
||||
|
||||
/** Default width to use when no width is specified */
|
||||
private readonly DEFAULT_WIDTH = 60;
|
||||
|
||||
@@ -66,14 +66,14 @@ export class Logger {
|
||||
*/
|
||||
public logBoxTitle(title: string, width?: number): void {
|
||||
this.currentBoxWidth = width || this.DEFAULT_WIDTH;
|
||||
|
||||
|
||||
// Create the title line with appropriate padding
|
||||
const paddedTitle = ` ${title} `;
|
||||
const remainingSpace = this.currentBoxWidth - 3 - paddedTitle.length;
|
||||
|
||||
|
||||
// Title line: ┌─ Title ───┐
|
||||
const titleLine = `┌─${paddedTitle}${'─'.repeat(Math.max(0, remainingSpace))}┐`;
|
||||
|
||||
|
||||
console.log(titleLine);
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ export class Logger {
|
||||
// No current width and no width provided, use default width
|
||||
this.logBoxTitle('', this.DEFAULT_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
const boxWidth = width || this.currentBoxWidth || this.DEFAULT_WIDTH;
|
||||
|
||||
|
||||
// Calculate the available space for content
|
||||
const availableSpace = boxWidth - 2; // Account for left and right borders
|
||||
|
||||
|
||||
if (content.length <= availableSpace - 1) {
|
||||
// If content fits with at least one space for the right border stripe
|
||||
const padding = availableSpace - content.length - 1;
|
||||
@@ -109,10 +109,10 @@ export class Logger {
|
||||
*/
|
||||
public logBoxEnd(width?: number): void {
|
||||
const boxWidth = width || this.currentBoxWidth || this.DEFAULT_WIDTH;
|
||||
|
||||
|
||||
// Create the bottom border: └────────┘
|
||||
console.log(`└${'─'.repeat(boxWidth - 2)}┘`);
|
||||
|
||||
|
||||
// Reset the current box width
|
||||
this.currentBoxWidth = null;
|
||||
}
|
||||
@@ -125,11 +125,11 @@ export class Logger {
|
||||
*/
|
||||
public logBox(title: string, lines: string[], width?: number): void {
|
||||
this.logBoxTitle(title, width || this.DEFAULT_WIDTH);
|
||||
|
||||
|
||||
for (const line of lines) {
|
||||
this.logBoxLine(line);
|
||||
}
|
||||
|
||||
|
||||
this.logBoxEnd();
|
||||
}
|
||||
|
||||
@@ -144,4 +144,4 @@ export class Logger {
|
||||
}
|
||||
|
||||
// Export a singleton instance for easy use
|
||||
export const logger = Logger.getInstance();
|
||||
export const logger = Logger.getInstance();
|
||||
|
Reference in New Issue
Block a user