UNPKG

claude-statusline-powerline

Version:

Beautiful powerline-style statusline for Claude Code with git integration, session tracking, and cost monitoring

50 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.truncate_text = truncate_text; exports.get_segment_max_length = get_segment_max_length; exports.truncate_segment_text = truncate_segment_text; /** * Truncate text with ellipsis if it exceeds the maximum length */ function truncate_text(text, max_length, ellipsis = '...') { if (text.length <= max_length) { return text; } const truncate_to = max_length - ellipsis.length; if (truncate_to <= 0) { return ellipsis.slice(0, max_length); } return text.slice(0, truncate_to) + ellipsis; } /** * Get the maximum length for a segment from config with fallbacks */ function get_segment_max_length(segment_type, style_override, config) { // Use style override if provided, otherwise use sensible defaults if (style_override?.truncation_length) { return style_override.truncation_length; } // Sensible defaults for each segment type switch (segment_type) { case 'model': return 15; case 'directory': return 25; case 'git': return 25; case 'session': return 30; case 'context': return 20; default: return 20; } } /** * Truncate text for a specific segment type using config */ function truncate_segment_text(text, segment_type, style_override, config) { const max_length = get_segment_max_length(segment_type, style_override, config); return truncate_text(text, max_length); } //# sourceMappingURL=text.js.map