Skip to main content

render_workstream_table

Function render_workstream_table 

Source
pub fn render_workstream_table(rows: &[WorkstreamRow]) -> String
Expand description

Render a tmux-list-sessions-style table of workstreams for tcode workstream list (DOC-48 §5.4, AC-5.1, issue #3296).

Why: rhymes with tm’s session-listing conventions (fixed-width columns, a leading marker for “the one that’s current”) WITHOUT importing from trusty-mpm — this crate has no dependency on it, so the shape is reinvented small and pure here. The leading * marker mirrors tmux’s own list-sessions attached-session convention, which DOC-48 §5.3 already cites as the mental model for workstream observation (“tmux-attach-like behavior”). What: one header line + one row per workstream: a leading * on the active workstream (blank otherwise), an 8-hex-char id prefix (DISPLAY ONLY — tcode workstream get/activate/close still require the full id; see crate::cli::workstream’s module docs in the tcode binary for why prefix resolution isn’t implemented client-side), the computed state, the live session count, a humanized updated_at age, and the name ((untitled) when empty, DOC-48 §5.1: “Name is initially empty”). An empty list renders one explanatory line instead of a bare header. Test: tests::render_workstream_table_marks_the_active_row, tests::render_workstream_table_handles_empty_list.