diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-11-19 00:28:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 00:28:04 -0500 |
commit | 92636f3bf91a1872b6b4249e78fce79e9fb51b6d (patch) | |
tree | 7660dc17555891b1016cc57df9c9bc644feadfbc /src/app.rs | |
parent | c0a8c347e12ae7924ed78ee9c35f2acd7152193e (diff) |
feature: Add mem_as_value flag (#309)
Adds a new flag, --mem_as_value (and its corresponding config option, mem_as_value = true), which defaults to showing process memory values by their amount rather than percentage.
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 39 |
1 files changed, 21 insertions, 18 deletions
@@ -1,4 +1,5 @@ -use std::{collections::HashMap, io::Write, path::PathBuf, time::Instant}; +// use std::io::Write; +use std::{collections::HashMap, path::PathBuf, time::Instant}; use unicode_segmentation::GraphemeCursor; use unicode_width::{UnicodeWidthChar, UnicodeWidthStr}; @@ -1405,23 +1406,25 @@ impl App { /// Call this whenever the config value is updated! fn update_config_file(&mut self) -> anyhow::Result<()> { - if self.app_config_fields.no_write { - // debug!("No write enabled. Config will not be written."); - // Don't write! - // FIXME: [CONFIG] This should be made VERY clear to the user... make a thing saying "it will not write due to no_write option" - Ok(()) - } else if let Some(config_path) = &self.config_path { - // Update - // debug!("Updating config file - writing to: {:?}", config_path); - std::fs::File::create(config_path)? - .write_all(self.config.get_config_as_bytes()?.as_ref())?; - Ok(()) - } else { - // FIXME: [CONFIG] Put an actual error message? - Err(anyhow::anyhow!( - "Config path was missing, please try restarting bottom..." - )) - } + // TODO: Disabled. + // if self.app_config_fields.no_write { + // // debug!("No write enabled. Config will not be written."); + // // Don't write! + // // FIXME: [CONFIG] This should be made VERY clear to the user... make a thing saying "it will not write due to no_write option" + // Ok(()) + // } else if let Some(config_path) = &self.config_path { + // // Update + // // debug!("Updating config file - writing to: {:?}", config_path); + // std::fs::File::create(config_path)? + // .write_all(self.config.get_config_as_bytes()?.as_ref())?; + // Ok(()) + // } else { + // // FIXME: [CONFIG] Put an actual error message? + // Err(anyhow::anyhow!( + // "Config path was missing, please try restarting bottom..." + // )) + // } + Ok(()) } pub fn kill_highlighted_process(&mut self) -> Result<()> { |