leenfetch_core/
lib.rs

1pub mod config;
2pub mod core;
3pub mod modules;
4pub mod system_info;
5#[cfg(test)]
6pub mod test_utils;
7
8pub use system_info::{PROTOCOL_VERSION, SystemInfo};
9
10use anyhow::Result;
11use config::settings::Config;
12use core::Core;
13
14/// Collects system information using the provided configuration and returns the stable JSON model.
15pub fn gather_system_info(config: &Config) -> Result<SystemInfo> {
16    let mut effective = config.clone();
17    if effective.layout.is_empty() {
18        effective.layout = crate::config::default_layout();
19    }
20
21    let core = Core::new_with(effective.flags.clone(), effective.layout.clone());
22    let data = core.collect_data();
23    Ok(SystemInfo::from(data))
24}