Update hyfetch.rs
This commit is contained in:
parent
34583294c6
commit
666d2dc90a
1 changed files with 13 additions and 52 deletions
|
|
@ -65,14 +65,12 @@ fn main() -> Result<()> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if options.test_print {
|
if options.test_print {
|
||||||
let asc = get_distro_ascii(distro, backend).context("failed to get distro ascii")?;
|
println!("{asc}", asc = get_distro_ascii(distro, backend)?.asc);
|
||||||
println!("{asc}", asc = asc.asc);
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.print_font_logo {
|
if options.print_font_logo {
|
||||||
let logo = get_font_logo(backend).context("failed to get font logo")?;
|
println!("{}", get_font_logo(backend)?);
|
||||||
println!("{logo}");
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,13 +309,8 @@ fn create_config(
|
||||||
.expect("`option_counter` should not overflow `u8`");
|
.expect("`option_counter` should not overflow `u8`");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_title_prompt(
|
fn print_title_prompt(option_counter: NonZeroU8, prompt: &str) {
|
||||||
option_counter: NonZeroU8,
|
printc!("&a{option_counter}. {prompt}");
|
||||||
prompt: &str,
|
|
||||||
color_mode: AnsiMode,
|
|
||||||
) -> Result<()> {
|
|
||||||
printc(format!("&a{option_counter}. {prompt}"), color_mode)
|
|
||||||
.context("failed to print prompt")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
@ -327,14 +320,8 @@ fn create_config(
|
||||||
let (Width(term_w), Height(term_h)) = terminal_size().context("failed to get terminal size")?;
|
let (Width(term_w), Height(term_h)) = terminal_size().context("failed to get terminal size")?;
|
||||||
let (term_w_min, term_h_min) = ((asc.w as u32 * 2 + 4).clamp(0, u16::MAX.into()) as u16, 30);
|
let (term_w_min, term_h_min) = ((asc.w as u32 * 2 + 4).clamp(0, u16::MAX.into()) as u16, 30);
|
||||||
if term_w < term_w_min || term_h < term_h_min {
|
if term_w < term_w_min || term_h < term_h_min {
|
||||||
printc(
|
printc!("&cWarning: Your terminal is too small ({term_w} * {term_h}).\n\
|
||||||
format!(
|
Please resize it to at least ({term_w_min} * {term_h_min}) for better experience.");
|
||||||
"&cWarning: Your terminal is too small ({term_w} * {term_h}).\nPlease resize \
|
|
||||||
it to at least ({term_w_min} * {term_h_min}) for better experience."
|
|
||||||
),
|
|
||||||
color_mode,
|
|
||||||
)
|
|
||||||
.context("failed to print message")?;
|
|
||||||
input(Some("Press enter to continue...")).context("failed to read input")?;
|
input(Some("Press enter to continue...")).context("failed to read input")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,11 +388,7 @@ fn create_config(
|
||||||
print_color_testing("RGB Color Testing", AnsiMode::Rgb);
|
print_color_testing("RGB Color Testing", AnsiMode::Rgb);
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
print_title_prompt(
|
print_title_prompt(option_counter, "Which &bcolor system &ado you want to use?");
|
||||||
option_counter,
|
|
||||||
"Which &bcolor system &ado you want to use?",
|
|
||||||
color_mode,
|
|
||||||
)?;
|
|
||||||
println!("(If you can't see colors under \"RGB Color Testing\", please choose 8bit)\n");
|
println!("(If you can't see colors under \"RGB Color Testing\", please choose 8bit)\n");
|
||||||
|
|
||||||
let choice = literal_input(
|
let choice = literal_input(
|
||||||
|
|
@ -439,12 +422,7 @@ fn create_config(
|
||||||
|
|
||||||
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
||||||
|
|
||||||
print_title_prompt(
|
print_title_prompt(option_counter, "Is your terminal in &blight mode&~ or &4dark mode&~?");
|
||||||
option_counter,
|
|
||||||
"Is your terminal in &blight mode&~ or &4dark mode&~?",
|
|
||||||
color_mode,
|
|
||||||
)
|
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
let choice = literal_input(
|
let choice = literal_input(
|
||||||
"",
|
"",
|
||||||
TerminalTheme::VARIANTS,
|
TerminalTheme::VARIANTS,
|
||||||
|
|
@ -523,8 +501,7 @@ fn create_config(
|
||||||
|
|
||||||
let print_flag_page = |page, page_num: u8| -> Result<()> {
|
let print_flag_page = |page, page_num: u8| -> Result<()> {
|
||||||
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
||||||
print_title_prompt(option_counter, "Let's choose a flag!", color_mode)
|
print_title_prompt(option_counter, "Let's choose a flag!");
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
println!("Available flag presets:\nPage: {page_num} of {num_pages}\n", page_num = page_num + 1);
|
println!("Available flag presets:\nPage: {page_num} of {num_pages}\n", page_num = page_num + 1);
|
||||||
for &row in page {
|
for &row in page {
|
||||||
print_flag_row(row, color_mode).context("failed to print flag row")?;
|
print_flag_row(row, color_mode).context("failed to print flag row")?;
|
||||||
|
|
@ -617,12 +594,7 @@ fn create_config(
|
||||||
|
|
||||||
let select_lightness = || -> Result<Lightness> {
|
let select_lightness = || -> Result<Lightness> {
|
||||||
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
||||||
print_title_prompt(
|
print_title_prompt(option_counter, "Let's adjust the color brightness!");
|
||||||
option_counter,
|
|
||||||
"Let's adjust the color brightness!",
|
|
||||||
color_mode,
|
|
||||||
)
|
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
println!(
|
println!(
|
||||||
"The colors might be a little bit too {bright_dark} for {light_dark} mode.\n",
|
"The colors might be a little bit too {bright_dark} for {light_dark} mode.\n",
|
||||||
bright_dark = match theme {
|
bright_dark = match theme {
|
||||||
|
|
@ -831,12 +803,7 @@ fn create_config(
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
|
|
||||||
print_title_prompt(
|
print_title_prompt(option_counter, "Do you want the default logo, or the small logo?");
|
||||||
option_counter,
|
|
||||||
"Do you want the default logo, or the small logo?",
|
|
||||||
color_mode,
|
|
||||||
)
|
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
let opts: Vec<Cow<str>> = ["default", "small"].map(Into::into).into();
|
let opts: Vec<Cow<str>> = ["default", "small"].map(Into::into).into();
|
||||||
let choice = literal_input("Your choice?", &opts[..], "default", true, color_mode)
|
let choice = literal_input("Your choice?", &opts[..], "default", true, color_mode)
|
||||||
.context("failed to ask for choice input")
|
.context("failed to ask for choice input")
|
||||||
|
|
@ -954,12 +921,7 @@ fn create_config(
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
|
|
||||||
print_title_prompt(
|
print_title_prompt(option_counter, "Let's choose a color arrangement!");
|
||||||
option_counter,
|
|
||||||
"Let's choose a color arrangement!",
|
|
||||||
color_mode,
|
|
||||||
)
|
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
println!("You can choose standard horizontal or vertical alignment, or use one of the random color schemes.\nYou can type \"roll\" to randomize again.\n");
|
println!("You can choose standard horizontal or vertical alignment, or use one of the random color schemes.\nYou can type \"roll\" to randomize again.\n");
|
||||||
let mut opts: Vec<Cow<str>> = ["horizontal", "vertical", "roll"].map(Into::into).into();
|
let mut opts: Vec<Cow<str>> = ["horizontal", "vertical", "roll"].map(Into::into).into();
|
||||||
opts.extend((0..random_count).map(|i| format!("random{i}").into()));
|
opts.extend((0..random_count).map(|i| format!("random{i}").into()));
|
||||||
|
|
@ -999,8 +961,7 @@ fn create_config(
|
||||||
|
|
||||||
let select_backend = || -> Result<Backend> {
|
let select_backend = || -> Result<Backend> {
|
||||||
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
clear_screen(Some(&title), color_mode, debug_mode).context("failed to clear screen")?;
|
||||||
print_title_prompt(option_counter, "Select a *fetch backend", color_mode)
|
print_title_prompt(option_counter, "Select a *fetch backend");
|
||||||
.context("failed to print title prompt")?;
|
|
||||||
|
|
||||||
// Check if fastfetch is installed
|
// Check if fastfetch is installed
|
||||||
let fastfetch_path = fastfetch_path().ok();
|
let fastfetch_path = fastfetch_path().ok();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue