UNPKG

@t1mmen/srtd

Version:

Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀

28 lines • 978 B
import chalk from 'chalk'; /** * Renders error context with gutter lines. * Shared between errorDisplay and resultsTable (watch mode). * * Format: * | error message * | SQL snippet * | ^ caret */ export function renderErrorContext(options) { const gutter = chalk.dim('\u2502'); // Unicode box drawing vertical line const indent = options.indentPrefix ?? ''; if (options.message) { console.log(`${indent}${gutter} ${chalk.red(options.message)}`); } if (options.hint) { console.log(`${indent}${gutter} ${chalk.cyan('Hint:')} ${options.hint}`); } if (options.sqlSnippet) { console.log(`${indent}${gutter} ${options.sqlSnippet}`); if (options.column !== undefined && options.column > 0) { const caretLine = ' '.repeat(options.column - 1) + chalk.yellow('^'); console.log(`${indent}${gutter} ${caretLine}`); } } } //# sourceMappingURL=errorContext.js.map