winbrew_app\operations/
info.rs1use anyhow::Result;
2
3use crate::core::paths::ResolvedPaths;
4use crate::models::domains::install::Architecture;
5use crate::models::domains::reporting::InfoReport;
6use crate::models::domains::shared::ConfigSection;
7use crate::report;
8use crate::version;
9
10pub fn collect(sections: &[ConfigSection], resolved_paths: &ResolvedPaths) -> Result<InfoReport> {
11 Ok(InfoReport {
12 version: version::package_version().to_string(),
13 system: system_entries(),
14 runtime: report::runtime_report(sections, resolved_paths)?,
15 })
16}
17
18fn system_entries() -> Vec<(String, String)> {
19 let host_profile = crate::windows::host::host_profile();
20 let family = if host_profile.is_server {
21 "Windows.Server"
22 } else {
23 "Windows.Desktop"
24 };
25
26 let windows_label = crate::windows::host::windows_version_string()
27 .map(|version| format!("{family} v{version}"))
28 .unwrap_or_else(|| family.to_string());
29
30 vec![
31 ("Windows".to_string(), windows_label),
32 (
33 "System Architecture".to_string(),
34 architecture_label(host_profile.architecture).to_string(),
35 ),
36 ]
37}
38
39fn architecture_label(architecture: Architecture) -> &'static str {
40 match architecture {
41 Architecture::X64 => "X64",
42 Architecture::X86 => "X86",
43 Architecture::Arm64 => "ARM64",
44 Architecture::Any => "Unknown",
45 }
46}