From 0ed0f18bb3f9b8aa22fb8b4095fdd0f74d20a921 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 19 May 2025 17:59:44 +0300 Subject: [PATCH] main: delete historical logging code --- src/main.rs | 261 ---------------------------------------------------- 1 file changed, 261 deletions(-) diff --git a/src/main.rs b/src/main.rs index 18341a6..9902b79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -192,267 +192,6 @@ fn real_main() -> anyhow::Result<()> { Ok(()) } } - - // TODO: This will be moved to a different module in the future. - // Some(Command::Info) => match monitor::collect_system_report(&config) { - // Ok(report) => { - // // Format section headers with proper centering - // let format_section = |title: &str| { - // let title_len = title.len(); - // let total_width = title_len + 8; // 8 is for padding (4 on each side) - // let separator = "═".repeat(total_width); - - // println!("\n╔{separator}╗"); - - // // Calculate centering - // println!("║ {title} ║"); - - // println!("╚{separator}╝"); - // }; - - // format_section("System Information"); - // println!("CPU Model: {}", report.system_info.cpu_model); - // println!("Architecture: {}", report.system_info.architecture); - // println!( - // "Linux Distribution: {}", - // report.system_info.linux_distribution - // ); - - // // Format timestamp in a readable way - // println!("Current Time: {}", jiff::Timestamp::now()); - - // format_section("CPU Global Info"); - // println!( - // "Current Governor: {}", - // report - // .cpu_global - // .current_governor - // .as_deref() - // .unwrap_or("N/A") - // ); - // println!( - // "Available Governors: {}", // 21 length baseline - // report.cpu_global.available_governors.join(", ") - // ); - // println!( - // "Turbo Status: {}", - // match report.cpu_global.turbo_status { - // Some(true) => "Enabled", - // Some(false) => "Disabled", - // None => "Unknown", - // } - // ); - - // println!( - // "EPP: {}", - // report.cpu_global.epp.as_deref().unwrap_or("N/A") - // ); - // println!( - // "EPB: {}", - // report.cpu_global.epb.as_deref().unwrap_or("N/A") - // ); - // println!( - // "Platform Profile: {}", - // report - // .cpu_global - // .platform_profile - // .as_deref() - // .unwrap_or("N/A") - // ); - // println!( - // "CPU Temperature: {}", - // report.cpu_global.average_temperature_celsius.map_or_else( - // || "N/A (No sensor detected)".to_string(), - // |t| format!("{t:.1}°C") - // ) - // ); - - // format_section("CPU Core Info"); - - // // Get max core ID length for padding - // let max_core_id_len = report - // .cpu_cores - // .last() - // .map_or(1, |core| core.core_id.to_string().len()); - - // // Table headers - // println!( - // " {:>width$} │ {:^10} │ {:^10} │ {:^10} │ {:^7} │ {:^9}", - // "Core", - // "Current", - // "Min", - // "Max", - // "Usage", - // "Temp", - // width = max_core_id_len + 4 - // ); - // println!( - // " {:─>width$}──┼─{:─^10}─┼─{:─^10}─┼─{:─^10}─┼─{:─^7}─┼─{:─^9}", - // "", - // "", - // "", - // "", - // "", - // "", - // width = max_core_id_len + 4 - // ); - - // for core_info in &report.cpu_cores { - // // Format frequencies: if current > max, show in a special way - // let current_freq = match core_info.current_frequency_mhz { - // Some(freq) => { - // let max_freq = core_info.max_frequency_mhz.unwrap_or(0); - // if freq > max_freq && max_freq > 0 { - // // Special format for boosted frequencies - // format!("{freq}*") - // } else { - // format!("{freq}") - // } - // } - // None => "N/A".to_string(), - // }; - - // // CPU core display - // println!( - // " Core {:10} │ {:>10} │ {:>10} │ {:>7} │ {:>9}", - // core_info.core_id, - // format!("{} MHz", current_freq), - // format!( - // "{} MHz", - // core_info - // .min_frequency_mhz - // .map_or_else(|| "N/A".to_string(), |f| f.to_string()) - // ), - // format!( - // "{} MHz", - // core_info - // .max_frequency_mhz - // .map_or_else(|| "N/A".to_string(), |f| f.to_string()) - // ), - // format!( - // "{}%", - // core_info - // .usage_percent - // .map_or_else(|| "N/A".to_string(), |f| format!("{f:.1}")) - // ), - // format!( - // "{}°C", - // core_info - // .temperature_celsius - // .map_or_else(|| "N/A".to_string(), |f| format!("{f:.1}")) - // ), - // width = max_core_id_len - // ); - // } - - // // Only display battery info for systems that have real batteries - // // Skip this section entirely on desktop systems - // if !report.batteries.is_empty() { - // let has_real_batteries = report.batteries.iter().any(|b| { - // // Check if any battery has actual battery data - // // (as opposed to peripherals like wireless mice) - // b.capacity_percent.is_some() || b.power_rate_watts.is_some() - // }); - - // if has_real_batteries { - // format_section("Battery Info"); - // for battery_info in &report.batteries { - // // Check if this appears to be a real system battery - // if battery_info.capacity_percent.is_some() - // || battery_info.power_rate_watts.is_some() - // { - // let power_status = if battery_info.ac_connected { - // "Connected to AC" - // } else { - // "Running on Battery" - // }; - - // println!("Battery {}:", battery_info.name); - // println!(" Power Status: {power_status}"); - // println!( - // " State: {}", - // battery_info.charging_state.as_deref().unwrap_or("Unknown") - // ); - - // if let Some(capacity) = battery_info.capacity_percent { - // println!(" Capacity: {capacity}%"); - // } - - // if let Some(power) = battery_info.power_rate_watts { - // let direction = if power >= 0.0 { - // "charging" - // } else { - // "discharging" - // }; - // println!( - // " Power Rate: {:.2} W ({})", - // power.abs(), - // direction - // ); - // } - - // // Display charge thresholds if available - // if battery_info.charge_start_threshold.is_some() - // || battery_info.charge_stop_threshold.is_some() - // { - // println!( - // " Charge Thresholds: {}-{}", - // battery_info - // .charge_start_threshold - // .map_or_else(|| "N/A".to_string(), |t| t.to_string()), - // battery_info - // .charge_stop_threshold - // .map_or_else(|| "N/A".to_string(), |t| t.to_string()) - // ); - // } - // } - // } - // } - // } - - // format_section("System Load"); - // println!( - // "Load Average (1m): {:.2}", - // report.system_load.load_avg_1min - // ); - // println!( - // "Load Average (5m): {:.2}", - // report.system_load.load_avg_5min - // ); - // println!( - // "Load Average (15m): {:.2}", - // report.system_load.load_avg_15min - // ); - // Ok(()) - // } - // Err(e) => Err(AppError::Monitor(e)), - // }, - // Some(CliCommand::SetPlatformProfile { profile }) => { - // // Get available platform profiles and validate early if possible - // match cpu::get_platform_profiles() { - // Ok(available_profiles) => { - // if available_profiles.contains(&profile) { - // log::info!("Setting platform profile to '{profile}'"); - // cpu::set_platform_profile(&profile).map_err(AppError::Control) - // } else { - // log::error!( - // "Invalid platform profile: '{}'. Available profiles: {}", - // profile, - // available_profiles.join(", ") - // ); - // Err(AppError::Generic(format!( - // "Invalid platform profile: '{}'. Available profiles: {}", - // profile, - // available_profiles.join(", ") - // ))) - // } - // } - // Err(_e) => { - // // If we can't get profiles (e.g., feature not supported), pass through to the function - // cpu::set_platform_profile(&profile).map_err(AppError::Control) - // } - // } - // } } fn main() {