use crate::microfetcher::{self, MicroFetcher};
use clap::{Parser, ValueEnum};
#[derive(Debug, Parser)]
#[clap(author, version, about)]
pub struct FetchCommand {
pub modules: Vec<InfoField>,
#[arg(long, default_value_t = false)]
pub no_module_names: bool,
#[arg(short, long)]
pub logo: Option<String>,
#[arg(long, default_value_t = false)]
pub no_logo: bool,
#[arg(long, default_value_t = 2)]
pub padding_before: usize,
#[arg(long, default_value_t = 2)]
pub padding_between: usize,
#[arg(short, long, default_value_t = false)]
pub raw: bool,
}
#[derive(Debug, ValueEnum, Clone, Copy)]
pub enum InfoField {
Colours,
ColoursBright,
ColoursDual,
CPU,
Disk,
Disks,
Desktop,
Empty,
Host,
Kernel,
Memory,
OS,
Shell,
Term,
Terminal,
Title,
Uptime,
User,
}
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),
}
}
}