fix: skip compact auto-detect when stdout is not a TTY#1111
Conversation
- Add std::io::stdout().is_terminal() check before compact threshold - Show full columns when output is piped or redirected - --compact flag still works as explicit override
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour output modules in ccusage are refactored to detect whether stdout is a terminal and only apply the width-based compact-mode threshold when running interactively. Each module imports ChangesTTY-aware compact mode
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I should add that in edge cases where piping/redirecting prevents automatic compact mode but shouldn't, there's still |
|
One more note: I have another PR in the pipeline to address a bug with |
|
@zcutlip could you. continue working on it |
|
when you finish ping me |
Addesses #1110
Summary by cubic
Skip compact auto-detection when stdout is not a TTY so piped/redirected output shows full columns.
--compactstill forces compact mode. Fixes #1110.stdout().is_terminal(); auto-compact only on TTYs.adapter/all.rs,adapter/amp.rs,blocks.rs, andoutput.rs.Written for commit dd300b2. Summary will update on new commits. Review in cubic
Summary by CodeRabbit