use crate::sysctl::display::DisplayType;
use crate::sysctl::section::Section;
use colored::Color;
use std::collections::HashMap;
macro_rules! map {
($( $key: expr => $val: expr ),*) => {{
let mut map = ::std::collections::HashMap::new();
$( map.insert($key, $val); )*
map
}}
}
#[derive(Clone, Debug)]
pub struct Config {
pub verbose: bool,
pub ignore_errors: bool,
pub quiet: bool,
pub no_pager: bool,
pub section_colors: HashMap<Section, Color>,
pub default_color: Color,
pub display_type: DisplayType,
}
impl Default for Config {
fn default() -> Self {
Self {
verbose: false,
ignore_errors: false,
quiet: false,
no_pager: false,
section_colors: map! {
Section::Abi => Color::Red,
Section::Fs => Color::Green,
Section::Kernel => Color::Magenta,
Section::Net => Color::Blue,
Section::Sunrpc => Color::Yellow,
Section::User => Color::Cyan,
Section::Vm => Color::BrightRed,
Section::Unknown => Color::White
},
default_color: Color::BrightBlack,
display_type: DisplayType::default(),
}
}
}