-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Description
Problem
rtk ls <dir> | wc -l returns a count inflated by 2 (blank line + summary line) because the 📊 summary is always written to stdout.
rtk ls src/ | wc -l # returns N+2 (wrong)
ls src/ | wc -l # returns N (correct)This breaks any script that pipes rtk ls to count files or process entries.
Unix Convention
Metadata/summary goes to stderr or is suppressed when stdout is not a TTY. RTK already uses this pattern in gain.rs via std::io::IsTerminal.
ls itself does this — no summary when piped.
Proposed Fix
Suppress the 📊 summary line when stdout is piped (not a TTY). Show it only in interactive mode.
Changes to src/ls.rs
- Add
use std::io::IsTerminal; - Split
compact_ls()return value into(entries: String, summary: String)tuple - In
run(): always print entries, only print summary whenstdout().is_terminal() - Track only what is actually sent to stdout for
rtk gainaccuracy
Verification
# Pipe mode — should NOT show summary
rtk ls src/ | wc -l
# TTY mode — should show summary
rtk ls src/Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels