diff options
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/options.rs b/src/options.rs index 0e24160b..37028be3 100644 --- a/src/options.rs +++ b/src/options.rs @@ -79,6 +79,7 @@ pub struct ConfigFlags { pub network_use_log: Option<bool>, pub network_use_binary_prefix: Option<bool>, pub enable_gpu_memory: Option<bool>, + pub enable_cache_memory: Option<bool>, #[serde(with = "humantime_serde")] #[serde(default)] pub retention: Option<Duration>, @@ -91,6 +92,8 @@ pub struct ConfigColours { pub avg_cpu_color: Option<Cow<'static, str>>, pub cpu_core_colors: Option<Vec<Cow<'static, str>>>, pub ram_color: Option<Cow<'static, str>>, + #[cfg(not(target_os = "windows"))] + pub cache_color: Option<Cow<'static, str>>, pub swap_color: Option<Cow<'static, str>>, pub arc_color: Option<Cow<'static, str>>, pub gpu_core_colors: Option<Vec<Cow<'static, str>>>, @@ -235,6 +238,7 @@ pub fn build_app( table_gap: u16::from(!(is_flag_enabled!(hide_table_gap, matches, config))), disable_click: is_flag_enabled!(disable_click, matches, config), enable_gpu_memory: get_enable_gpu_memory(matches, config), + enable_cache_memory: get_enable_cache_memory(matches, config), show_table_scroll_position: is_flag_enabled!(show_table_scroll_position, matches, config), is_advanced_kill, network_scale_type, @@ -382,6 +386,7 @@ pub fn build_app( let used_widgets = UsedWidgets { use_cpu: used_widget_set.get(&Cpu).is_some() || used_widget_set.get(&BasicCpu).is_some(), use_mem, + use_cache: use_mem && get_enable_cache_memory(matches, config), use_gpu: use_mem && get_enable_gpu_memory(matches, config), use_net: used_widget_set.get(&Net).is_some() || used_widget_set.get(&BasicNet).is_some(), use_proc: used_widget_set.get(&Proc).is_some(), @@ -712,6 +717,22 @@ fn get_enable_gpu_memory(matches: &ArgMatches, config: &Config) -> bool { false } +#[allow(unused_variables)] +fn get_enable_cache_memory(matches: &ArgMatches, config: &Config) -> bool { + #[cfg(not(target_os = "windows"))] + { + if matches.contains_id("enable_cache_memory") { + return true; + } else if let Some(flags) = &config.flags { + if let Some(enable_cache_memory) = flags.enable_cache_memory { + return enable_cache_memory; + } + } + } + + false +} + fn get_ignore_list(ignore_list: &Option<IgnoreList>) -> error::Result<Option<Filter>> { if let Some(ignore_list) = ignore_list { let list: Result<Vec<_>, _> = ignore_list |