fix: fix os and host detection on Windows

This commit is contained in:
Adrian Groh 2023-02-24 18:57:29 +01:00
parent 71dac6a933
commit ab02f3c39e
Signed by: Gobidev
GPG Key ID: 3AA3153E98B0D771
2 changed files with 21 additions and 20 deletions

View File

@ -341,13 +341,12 @@ pub fn host(general_readout: &GeneralReadout) -> Option<String> {
Some(final_str) Some(final_str)
} }
} }
"macos" => match general_readout.machine() { _ => match general_readout.machine() {
Ok(host) => Some(host), Ok(host) => Some(host),
Err(_) => None, Err(_) => match general_readout.cpu_model_name() {
}, Ok(host) => Some(host),
_ => match general_readout.cpu_model_name() { Err(_) => None,
Ok(host) => Some(host), },
Err(_) => None,
}, },
} }
} }

View File

@ -251,7 +251,7 @@ fn main() {
kernel_readout: KernelReadout::new(), kernel_readout: KernelReadout::new(),
}; };
let os = get_info(&PfetchInfo::Os, &readouts, skip_slow_package_managers).unwrap_or_default(); let os = pfetch::os(&GeneralReadout::new()).unwrap_or_default();
let logo_override = env::var("PF_ASCII"); let logo_override = env::var("PF_ASCII");
@ -277,19 +277,21 @@ fn main() {
let gathered_pfetch_info: Vec<(pfetch::Color, String, String)> = enabled_pf_info let gathered_pfetch_info: Vec<(pfetch::Color, String, String)> = enabled_pf_info
.iter() .iter()
.filter_map(|info| { .filter_map(|info| match info {
let info_result = get_info(info, &readouts, skip_slow_package_managers); PfetchInfo::Os => Some((logo.primary_color, info.to_string(), os.clone())),
match info_result { _ => {
Some(info_str) => match info { let info_result = get_info(info, &readouts, skip_slow_package_managers);
PfetchInfo::Title => Some((logo.secondary_color, info_str, "".to_string())), match info_result {
PfetchInfo::Os => Some((logo.primary_color, info.to_string(), os.to_owned())), Some(info_str) => match info {
PfetchInfo::BlankLine => { PfetchInfo::Title => Some((logo.secondary_color, info_str, "".to_string())),
Some((logo.primary_color, "".to_string(), "".to_string())) PfetchInfo::BlankLine => {
} Some((logo.primary_color, "".to_string(), "".to_string()))
PfetchInfo::Palette => Some((logo.primary_color, info_str, "".to_string())), }
_ => Some((logo.primary_color, info.to_string(), info_str)), PfetchInfo::Palette => Some((logo.primary_color, info_str, "".to_string())),
}, _ => Some((logo.primary_color, info.to_string(), info_str)),
None => None, },
None => None,
}
} }
}) })
.collect(); .collect();