other: make advanced kill default (#463)

We make the advanced kill menu the default instead. You can opt out with disable_advanced_kill.
This commit is contained in:
Clement Tsang 2021-05-06 23:35:30 -04:00 committed by GitHub
parent fbfa708d1d
commit ae59489466
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 43 deletions

View file

@ -252,7 +252,6 @@ Run using `btm`.
Use `btm --help` for more information.
```
--advanced_kill Shows more options when killing a process on Unix-like systems.
--autohide_time Temporarily shows the time scale in graphs.
-b, --basic Hides graphs and uses a more basic look.
--battery Shows the battery widget.
@ -264,6 +263,7 @@ Use `btm --help` for more information.
-t, --default_time_value <MS> Default time value for graphs in ms.
--default_widget_count <INT> Sets the n'th selected widget type as the default.
--default_widget_type <WIDGET TYPE> Sets the default widget type, use --help for more info.
--disable_advanced_kill Hides advanced options to stop a process on Unix-like systems.
--disable_click Disables mouse clicks.
-m, --dot_marker Uses a dot marker for graphs.
-f, --fahrenheit Sets the temperature type to Fahrenheit.
@ -577,7 +577,7 @@ The following options can be set under `[flags]` to achieve the same effect as p
These are the following supported flag config values, which correspond to the flag of the same name described in [Flags](#flags):
| Field | Type | Functionality |
| ---------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| ---------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `hide_avg_cpu` | Boolean | Hides the average CPU usage. |
| `dot_marker` | Boolean | Uses a dot marker for graphs. |
| `left_legend` | Boolean | Puts the CPU chart legend to the left side. |
@ -601,7 +601,7 @@ These are the following supported flag config values, which correspond to the fl
| `tree` | Boolean | Defaults to showing the process widget in tree mode. |
| `show_table_scroll_position` | Boolean | Shows the scroll position tracker in table widgets. |
| `process_command` | Boolean | Show processes as their commands by default. |
| `advanced_kill` | Boolean | Shows more options when killing a process on Unix-like systems. |
| `disable_advanced_kill` | Boolean | Hides advanced options to stop a process on Unix-like systems. |
| `network_use_binary_prefix` | Boolean | Displays the network widget with binary prefixes. |
| `network_use_bytes` | Boolean | Displays the network widget using bytes. |
| `network_use_log` | Boolean | Displays the network widget with a log scale. |

View file

@ -187,12 +187,12 @@ Puts the CPU chart legend to the left side rather than the right side.\n\n",
When searching for a process, enables regex by default.\n\n",
);
let advanced_kill = Arg::with_name("advanced_kill")
.long("advanced_kill")
.help("Shows more options when killing a process on Unix-like systems.")
let disable_advanced_kill = Arg::with_name("disable_advanced_kill")
.long("disable_advanced_kill")
.help("Hides advanced options to stop a process on Unix-like systems.")
.long_help(
"\
Shows more options when killing a process on Unix-like systems.\n\n",
Hides advanced options to stop a process on Unix-like systems. The only option shown is -15.\n\n",
);
let show_table_scroll_position = Arg::with_name("show_table_scroll_position")
@ -441,7 +441,7 @@ Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rathe
.arg(hide_time)
.arg(show_table_scroll_position)
.arg(left_legend)
.arg(advanced_kill)
.arg(disable_advanced_kill)
// .arg(no_write)
.arg(rate)
.arg(regex)

View file

@ -496,8 +496,8 @@ pub const CONFIG_TEXT: &str = r##"# This is a default config file for bottom. A
#network_use_bytes = false
# Displays the network widget with a log scale.
#network_use_log = false
# Show a more advanced process kill screen
#advanced_kill = false
# Hides advanced options to stop a process on Unix-like systems.
#disable_advanced_kill = false
# These are all the components that support custom theming. Note that colour support
# will depend on terminal support.

View file

@ -158,7 +158,7 @@ pub struct ConfigFlags {
pub process_command: Option<bool>,
#[builder(default, setter(strip_option))]
pub advanced_kill: Option<bool>,
pub disable_advanced_kill: Option<bool>,
#[builder(default, setter(strip_option))]
pub network_use_bytes: Option<bool>,
@ -285,7 +285,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);
let is_advanced_kill = !get_is_advanced_kill_disabled(matches, config);
let network_unit_type = get_network_unit_type(matches, config);
let network_scale_type = get_network_scale_type(matches, config);
@ -1044,12 +1044,12 @@ 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") {
fn get_is_advanced_kill_disabled(matches: &clap::ArgMatches<'static>, config: &Config) -> bool {
if matches.is_present("disable_advanced_kill") {
return true;
} else if let Some(flags) = &config.flags {
if let Some(advanced_kill) = flags.advanced_kill {
return advanced_kill;
if let Some(disable_advanced_kill) = flags.disable_advanced_kill {
return disable_advanced_kill;
}
}
false