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)
}
}
"macos" => match general_readout.machine() {
_ => match general_readout.machine() {
Ok(host) => Some(host),
Err(_) => None,
},
_ => match general_readout.cpu_model_name() {
Ok(host) => Some(host),
Err(_) => None,
Err(_) => match general_readout.cpu_model_name() {
Ok(host) => Some(host),
Err(_) => None,
},
},
}
}

View File

@ -251,7 +251,7 @@ fn main() {
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");
@ -277,19 +277,21 @@ fn main() {
let gathered_pfetch_info: Vec<(pfetch::Color, String, String)> = enabled_pf_info
.iter()
.filter_map(|info| {
let info_result = get_info(info, &readouts, skip_slow_package_managers);
match info_result {
Some(info_str) => match info {
PfetchInfo::Title => Some((logo.secondary_color, info_str, "".to_string())),
PfetchInfo::Os => Some((logo.primary_color, info.to_string(), os.to_owned())),
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)),
},
None => None,
.filter_map(|info| match info {
PfetchInfo::Os => Some((logo.primary_color, info.to_string(), os.clone())),
_ => {
let info_result = get_info(info, &readouts, skip_slow_package_managers);
match info_result {
Some(info_str) => match info {
PfetchInfo::Title => Some((logo.secondary_color, info_str, "".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)),
},
None => None,
}
}
})
.collect();