Expand description
Display utilities for mi6-cli output formatting.
This module consolidates display logic into reusable components:
terminal: Terminal width detection and color supportstring: String truncation helpers (UTF-8 safe)colors: Color formatting helpers (bold, colored text)format: Number, duration, and byte formattingtable: Table header and column width calculationsevent: Event row formatting and detailsprompt: User confirmation prompts
Structs§
- Stderr
Colors - ANSI color codes for terminal output to stderr.
Constants§
- COL_APP
- COL_
DETAILS_ MIN - COL_
EVENT - COL_PID
- COL_
SESSION - COL_
SOURCE - COL_
TIME - DEFAULT_
TERMINAL_ WIDTH - Default terminal width if detection fails.
Functions§
- bold_
green - Format text as bold green.
- bold_
red - Format text as bold red.
- bold_
white - Format text as bold white.
- calculate_
details_ width - Calculate the details column width based on terminal width and whether APP column is shown.
- confirm
- Ask the user for confirmation, prompting on stderr.
- confirm_
stdout - Ask the user for confirmation, prompting on stdout.
- dark_
grey - Format text as dark grey (for hints).
- format_
bytes - Format bytes as a human-readable string.
- format_
details - Format details for an event.
- format_
duration - Format a duration in milliseconds as a human-readable string.
- format_
number - Format a large number with comma separators.
- framework_
abbrev - Get 3-letter abbreviation for a framework.
- get_
display_ event_ type - Get the display event type name for an event. For API requests, check metadata for Codex activity event types.
- get_
terminal_ width - Get terminal width using stty, falling back to default.
- percentage
- Calculate percentage with zero-division handling.
- print_
event_ row - Print a single event as a table row.
- print_
table_ header - Print the table header.
- truncate_
from_ start - Truncate a string from the start if it exceeds max_len. Returns the first max_len characters (no ellipsis added).
- truncate_
str - Truncate a string to a maximum number of characters, returning a reference to the truncated slice.
- truncate_
with_ prefix - Truncate a string with ellipsis prefix if it exceeds max_len. Returns the last (max_len - 3) characters prefixed with “…”.
- use_
colors - Check if we should use colors.
- use_
colors_ stderr - Check if we should use colors for stderr output.