nxfetch 0.3.0

A minimal, fast and batteries included fetcher!
Documentation
use crate::microfetcher::{self, MicroFetcher};
use clap::{Parser, ValueEnum};

#[derive(Debug, Parser)]
#[clap(author, version, about)]
pub struct FetchCommand {
    /// A list of module names nxfetch should display
    pub modules: Vec<InfoField>,

    /// Whether to hide the module names
    #[arg(long, default_value_t = false)]
    pub no_module_names: bool,

    /// Path to text file with ascii art to use as the logo
    #[arg(short, long)]
    pub logo: Option<String>,

    /// Whether to hide the logo
    #[arg(long, default_value_t = false)]
    pub no_logo: bool,

    /// Padding before the fetch
    #[arg(long, default_value_t = 2)]
    pub padding_before: usize,

    /// Padding between the logo and the text
    #[arg(long, default_value_t = 2)]
    pub padding_between: usize,

    /// Only print raw module output (same as `--no-logo --no-module-names --padding-before 0`,
    /// takes precedence over those args)
    #[arg(short, long, default_value_t = false)]
    pub raw: bool,
}

#[derive(Debug, ValueEnum, Clone, Copy)]
pub enum InfoField {
    Colours,
    ColoursBright,
    ColoursDual,
    CPU,
    // Custom(String),
    Disk,
    Disks,
    Desktop,
    Empty,
    //GPU,
    Host,
    Kernel,
    Memory,
    OS,
    //Packages,
    //Resolution,
    Shell,
    Term,
    Terminal,
    Title,
    Uptime,
    User,
    //WM,
}
impl InfoField {
    pub fn to_microfetcher(self) -> Box<dyn MicroFetcher> {
        match self {
            Self::Colours => Box::new(microfetcher::colors::Colors),
            Self::ColoursBright => Box::new(microfetcher::colors_bright::ColorsBright),
            Self::ColoursDual => Box::new(microfetcher::colors_dual::ColorsDual),
            Self::CPU => Box::new(microfetcher::cpu::CPU),
            Self::Desktop => Box::new(microfetcher::desktop::Desktop),
            Self::Disk => Box::new(microfetcher::disk::Disk),
            Self::Disks => Box::new(microfetcher::disks::Disks),
            Self::Empty => Box::new(microfetcher::empty::Empty),
            Self::Host => Box::new(microfetcher::host::Host),
            Self::Kernel => Box::new(microfetcher::kernel::Kernel),
            Self::Memory => Box::new(microfetcher::memory::Memory),
            Self::OS => Box::new(microfetcher::os::OS),
            Self::Shell => Box::new(microfetcher::shell::Shell),
            Self::Term => Box::new(microfetcher::term::Term),
            Self::Terminal => Box::new(microfetcher::terminal::Terminal),
            Self::Title => Box::new(microfetcher::title::Title),
            Self::Uptime => Box::new(microfetcher::uptime::Uptime),
            Self::User => Box::new(microfetcher::user::User),
        }
    }
}