[F] Fix distro name detection
This commit is contained in:
parent
93b4dd3471
commit
a5e784c528
2 changed files with 7 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -251,7 +251,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyfetch"
|
name = "hyfetch"
|
||||||
version = "2.0.0-rc5"
|
version = "2.0.0-rc6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"ansi_colours",
|
"ansi_colours",
|
||||||
|
|
|
||||||
|
|
@ -248,9 +248,7 @@ fn create_config(
|
||||||
debug!(?det_ansi, "detected color mode");
|
debug!(?det_ansi, "detected color mode");
|
||||||
|
|
||||||
// Try to get ascii from given backend first, if it fails, try neofetch backend
|
// Try to get ascii from given backend first, if it fails, try neofetch backend
|
||||||
let asc = get_distro_ascii(distro, backend).or_else(|_| {
|
let asc = get_distro_ascii(distro, backend).or_else(|_| get_distro_ascii(distro, Backend::Neofetch)).context("failed to get distro ascii from neofetch backend")?;
|
||||||
get_distro_ascii(distro, Backend::Neofetch).context("failed to get distro ascii from neofetch backend")
|
|
||||||
})?;
|
|
||||||
let asc = asc.to_normalized().context("failed to normalize ascii")?;
|
let asc = asc.to_normalized().context("failed to normalize ascii")?;
|
||||||
let theme = det_bg.map(|bg| bg.theme()).unwrap_or_default();
|
let theme = det_bg.map(|bg| bg.theme()).unwrap_or_default();
|
||||||
let color_mode = det_ansi.unwrap_or(AnsiMode::Ansi256);
|
let color_mode = det_ansi.unwrap_or(AnsiMode::Ansi256);
|
||||||
|
|
@ -769,13 +767,11 @@ fn create_config(
|
||||||
};
|
};
|
||||||
|
|
||||||
// get distro string and convert it into the enum, neofetch friendly format, so we can check for small logos with the {distro}_small neofetch naming scheme.
|
// get distro string and convert it into the enum, neofetch friendly format, so we can check for small logos with the {distro}_small neofetch naming scheme.
|
||||||
let get_current_dst_str= get_distro_name(backend).context("failed to get current distro.")?;
|
let tmp_dst = get_distro_name(backend).or_else(|_| get_distro_name(Backend::Neofetch)).context("failed to get distro name")?;
|
||||||
|
let detected_dst = Some(distro.map_or_else(
|
||||||
let detected_dst: Option<String> = if distro.is_none() {
|
|| format!("{:?}", Distro::detect(tmp_dst).unwrap()),
|
||||||
Some(format!("{:?}", Distro::detect(get_current_dst_str).unwrap()))
|
|d| d.to_string(),
|
||||||
} else {
|
));
|
||||||
Some(distro.unwrap().to_string())
|
|
||||||
};
|
|
||||||
|
|
||||||
// in case someone specified {distro}_small already in the --distro arg
|
// in case someone specified {distro}_small already in the --distro arg
|
||||||
let detected_dst_small_fmt = if !detected_dst.clone().unwrap().ends_with("_small") {
|
let detected_dst_small_fmt = if !detected_dst.clone().unwrap().ends_with("_small") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue