mirror of
https://github.com/jarrodwatts/claude-hud.git
synced 2026-05-04 19:42:40 +00:00
17 lines
637 B
JavaScript
17 lines
637 B
JavaScript
// Returns a progress bar width scaled to the current terminal width.
|
|
// Wide (>=100): 10, Medium (60-99): 6, Narrow (<60): 4. Defaults to 10.
|
|
export function getAdaptiveBarWidth() {
|
|
const stdoutCols = process.stdout?.columns;
|
|
const cols = (typeof stdoutCols === 'number' && Number.isFinite(stdoutCols) && stdoutCols > 0)
|
|
? Math.floor(stdoutCols)
|
|
: Number.parseInt(process.env.COLUMNS ?? '', 10);
|
|
if (Number.isFinite(cols) && cols > 0) {
|
|
if (cols >= 100)
|
|
return 10;
|
|
if (cols >= 60)
|
|
return 6;
|
|
return 4;
|
|
}
|
|
return 10;
|
|
}
|
|
//# sourceMappingURL=terminal.js.map
|