[+] Add print_font_logo CLI option
This commit is contained in:
parent
deb2bddbe1
commit
943503004d
2 changed files with 13 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ use hyfetch::presets::{AssignLightness, Preset};
|
|||
use hyfetch::pride_month;
|
||||
use hyfetch::types::{AnsiMode, Backend, TerminalTheme};
|
||||
use hyfetch::utils::{get_cache_path, input};
|
||||
use hyfetch::font_logo::get_font_logo;
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use itertools::Itertools as _;
|
||||
use palette::{LinSrgb, Srgb};
|
||||
|
|
@ -79,6 +80,12 @@ fn main() -> Result<()> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
if options.print_font_logo {
|
||||
let logo = get_font_logo(backend).context("failed to get font logo")?;
|
||||
writeln!(io::stdout(), "{}", logo).context("failed to write logo to stdout")?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let config = if options.config {
|
||||
create_config(&options.config_file, distro, backend, debug_mode)
|
||||
.context("failed to create config")?
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ pub struct Options {
|
|||
pub debug: bool,
|
||||
pub distro: Option<String>,
|
||||
pub ascii_file: Option<PathBuf>,
|
||||
pub print_font_logo: bool,
|
||||
pub test_print: bool,
|
||||
pub ask_exit: bool,
|
||||
}
|
||||
|
|
@ -157,6 +158,10 @@ BACKEND={{{backends}}}",
|
|||
#[cfg(feature = "autocomplete")]
|
||||
let ascii_file = ascii_file.complete_shell(ShellComp::Nothing);
|
||||
let ascii_file = ascii_file.optional();
|
||||
let print_font_logo = long("print-font-logo")
|
||||
.help("Print the Font Logo / Nerd Font icon of your distro and exit")
|
||||
.switch();
|
||||
// hidden
|
||||
let test_print = long("test-print")
|
||||
.help("Print the ascii distro and exit")
|
||||
.switch()
|
||||
|
|
@ -179,6 +184,7 @@ BACKEND={{{backends}}}",
|
|||
debug,
|
||||
distro,
|
||||
ascii_file,
|
||||
print_font_logo,
|
||||
// hidden
|
||||
test_print,
|
||||
ask_exit,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue