1use argyph_core::{IndexStatus, TierState};
2use argyph_fs::FileEntry;
3
4pub fn status_table(
5 tier_state: &TierState,
6 status: &IndexStatus,
7 files: &[FileEntry],
8 watcher_active: bool,
9) {
10 println!("Index Status");
11 println!(" tier: {tier_state}");
12 println!(" ready: {}", tier_state.is_ready());
13 println!(" tier number: {}", tier_state.tier_number());
14 println!(" files: {}", status.file_count);
15 println!(
16 " watcher: {}",
17 if watcher_active { "active" } else { "inactive" }
18 );
19 println!(" version: {}", status.protocol_version);
20
21 if !files.is_empty() {
22 let mut lang_counts: std::collections::HashMap<String, u64> =
23 std::collections::HashMap::new();
24 for f in files {
25 if let Some(lang) = &f.language {
26 *lang_counts.entry(lang.to_string()).or_default() += 1;
27 }
28 }
29 println!(" languages:");
30 let mut pairs: Vec<_> = lang_counts.into_iter().collect();
31 pairs.sort_by(|a, b| b.1.cmp(&a.1));
32 for (lang, count) in &pairs {
33 println!(" {lang}: {count}");
34 }
35 }
36}