import util from "node:util"; /** * Text formatting utilities for the CLI. * * Uses ANSI escape codes to format text. * * AI Generated links: * @see https://en.wikipedia.org/wiki/ANSI_escape_code * @see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Formatting * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Cursor_movement * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Screen_manipulation */ const BOLD = "\x1b[1m"; export const bold = (text: string) => `${BOLD}${text}${RESET}`; const DIM = "\x1b[2m"; export const dim = (text: string) => `${DIM}${text}${RESET}`; const UNDERLINE = "\x1b[4m"; export const underline = (text: string) => `${UNDERLINE}${text}${RESET}`; const INVERSE = "\x1b[7m"; export const inverse = (text: string) => `${INVERSE}${text}${RESET}`; const HIDDEN = "\x1b[8m"; export const hidden = (text: string) => `${HIDDEN}${text}${RESET}`; const STRIKETHROUGH = "\x1b[9m"; export const strikethrough = (text: string) => `${STRIKETHROUGH}${text}${RESET}`; const RESET = "\x1b[0m"; export const reset = (text: string) => `${RESET}${text}${RESET}`; export const formatObject = (obj: unknown) => { return util.inspect(obj, { depth: null, colors: true, compact: false }); };