Skip to content

Commit 3940f08

Browse files
committed
Prints top 15 files consuming tokens
1 parent e271ee0 commit 3940f08

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/output.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ pub fn display_token_counts(token_counter: TokenCounter, entries: &[FileEntry])
4747
println!("\nToken Count Summary:");
4848
println!("Total tokens: {}", token_count.total_tokens);
4949
println!("\nBreakdown by file:");
50-
for (path, count) in token_count.breakdown {
50+
51+
// Sorting breakdown
52+
let mut breakdown = token_count.breakdown;
53+
breakdown.sort_by(|(_, a), (_, b)| b.cmp(a));
54+
let top_files = breakdown.iter().take(15);
55+
56+
for (path, count) in top_files {
5157
println!(" {}: {}", path.display(), count);
5258
}
5359

0 commit comments

Comments
 (0)