diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2021-02-15 22:23:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 22:23:22 -0500 |
commit | e437b14922c688b1f5bbfcb4d13387564be34be0 (patch) | |
tree | 17f69d7247a406216e14937f0ccb4e3cdd683a6a /src/options.rs | |
parent | fb7b1226fd610b53d1ba06e2c3d55f0100ebdb2f (diff) |
feature: Allow toggling advanced kill menu (#408)
Allows toggling the advanced kill menu via --advanced_kill or advanced_kill=true.
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/options.rs b/src/options.rs index 999a8cf1..badc32b8 100644 --- a/src/options.rs +++ b/src/options.rs @@ -154,6 +154,9 @@ pub struct ConfigFlags { #[builder(default, setter(strip_option))] pub process_command: Option<bool>, + + #[builder(default, setter(strip_option))] + pub advanced_kill: Option<bool>, } #[derive(Clone, Default, Debug, Deserialize, Serialize)] @@ -260,6 +263,7 @@ pub fn build_app( let show_memory_as_values = get_mem_as_value(matches, config); let is_default_tree = get_is_default_tree(matches, config); let is_default_command = get_is_default_process_command(matches, config); + let is_advanced_kill = get_is_using_advanced_kill(matches, config); for row in &widget_layout.rows { for col in &row.children { @@ -399,6 +403,7 @@ pub fn build_app( // no_write: get_no_write(matches, config), no_write: false, show_table_scroll_position: get_show_table_scroll_position(matches, config), + is_advanced_kill, }; let used_widgets = UsedWidgets { @@ -1015,3 +1020,14 @@ fn get_is_default_process_command(matches: &clap::ArgMatches<'static>, config: & } false } + +fn get_is_using_advanced_kill(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { + if matches.is_present("advanced_kill") { + return true; + } else if let Some(flags) = &config.flags { + if let Some(advanced_kill) = flags.advanced_kill { + return advanced_kill; + } + } + false +} |