Summary
ConsoleUi.PrintUsage() emits long usage lines (some ~180 chars wide) without consulting GetWindowWidth(), even though GetWindowWidth() exists for the spinner / progress-bar code path. On 80-column terminals (CI logs, default tmux panes, narrow SSH windows) usage text wraps mid-flag and becomes unreadable. On wider terminals the text uses only the leftmost 80 columns, wasting screen real estate.
Distinct from #1629 (GetWindowWidth catches all exceptions and returns 80) — that fixes the width detection; C270 is that PrintUsage doesn't use the detected width regardless of #1629's outcome.
Where
src/CodeIndex/Cli/ConsoleUi.cs:330-450 (PrintUsage — fixed-width output)
src/CodeIndex/Cli/ConsoleUi.cs:858-868 (GetWindowWidth — already implemented but unused here)
Suggested approach
(1) Wire PrintUsage to wrap option descriptions at min(GetWindowWidth(), 120) columns, preserving the option-name column. (2) For pipes / non-TTY (already detected via ShouldUseInteractiveConsole), fall back to the current fixed format. (3) Verify against cdidx --help | cat and COLUMNS=200 cdidx --help to confirm both narrow and wide cases render correctly.
Summary
ConsoleUi.PrintUsage()emits long usage lines (some ~180 chars wide) without consultingGetWindowWidth(), even thoughGetWindowWidth()exists for the spinner / progress-bar code path. On 80-column terminals (CI logs, default tmux panes, narrow SSH windows) usage text wraps mid-flag and becomes unreadable. On wider terminals the text uses only the leftmost 80 columns, wasting screen real estate.Distinct from #1629 (GetWindowWidth catches all exceptions and returns 80) — that fixes the width detection; C270 is that
PrintUsagedoesn't use the detected width regardless of #1629's outcome.Where
src/CodeIndex/Cli/ConsoleUi.cs:330-450(PrintUsage — fixed-width output)src/CodeIndex/Cli/ConsoleUi.cs:858-868(GetWindowWidth — already implemented but unused here)Suggested approach
(1) Wire
PrintUsageto wrap option descriptions atmin(GetWindowWidth(), 120)columns, preserving the option-name column. (2) For pipes / non-TTY (already detected viaShouldUseInteractiveConsole), fall back to the current fixed format. (3) Verify againstcdidx --help | catandCOLUMNS=200 cdidx --helpto confirm both narrow and wide cases render correctly.