added potion-polyglot worker folder w/o repos
This commit is contained in:
13
worker-toolkit-potion-polyglot/scripts/lib/notice-banner.ts
Normal file
13
worker-toolkit-potion-polyglot/scripts/lib/notice-banner.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Wrap a notice in a banner loud enough to survive a scrollback.
|
||||
*
|
||||
* Yellow only when stderr is a terminal, so piped logs stay clean.
|
||||
*/
|
||||
export function banner(message: string, headline: string): string {
|
||||
const RULE = '#'.repeat(78);
|
||||
const pad = ' '.repeat(Math.max(0, Math.floor((78 - headline.length) / 2)));
|
||||
|
||||
const body = [RULE, `${pad}${headline}`, RULE, '', message, RULE].join('\n');
|
||||
const color = process.stderr.isTTY ? ['\u001b[33m', '\u001b[39m'] : ['', ''];
|
||||
return `${color[0]}${body}${color[1]}`;
|
||||
}
|
||||
Reference in New Issue
Block a user