diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | src/app.rs | 1 | ||||
-rw-r--r-- | src/canvas/widgets/cpu_graph.rs | 2 | ||||
-rw-r--r-- | src/canvas/widgets/disk_table.rs | 2 | ||||
-rw-r--r-- | src/canvas/widgets/process_table.rs | 2 | ||||
-rw-r--r-- | src/canvas/widgets/temp_table.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 3 | ||||
-rw-r--r-- | src/options.rs | 16 |
9 files changed, 28 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ddd99ea..0de1ea0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - In addition, changed to using only legends within the graph for network, as well as redesigned the legend. The old legend style can still be used via the `--use_old_network_legend` flag or `use_old_network_legend = true` option. - - Removed header gap on tables. + - Allow for option to hide the header gap on tables. ### Bug Fixes @@ -140,6 +140,8 @@ Run using `btm`. -R, --regex Search defaults to using regex -s, --show_disabled_data Shows disabled CPU entries in the CPU legend -b, --basic Enables basic mode, removing charts and condensing data + --use_old_network_legend Use the older (pre-0.4) network legend which is separate from the network chart + --hide_table_gap Hides the spacing between table headers and data ``` ### Options @@ -287,6 +289,8 @@ These are the following supported flag config values: | `regex` | Boolean | | `show_disabled_data` | Boolean | | `basic` | Boolean | +| `hide_table_count`| Boolean | +| `use_old_network_legend`| Boolean | | `rate` | Unsigned Int (represents milliseconds) | | `default_time_value` | Unsigned Int (represents milliseconds) | | `time_delta` | Unsigned Int (represents milliseconds) | @@ -91,6 +91,7 @@ pub struct AppConfigFields { pub hide_time: bool, pub autohide_time: bool, pub use_old_network_legend: bool, + pub table_gap: u16 } /// AppSearchState deals with generic searching (I might do this in the future). diff --git a/src/canvas/widgets/cpu_graph.rs b/src/canvas/widgets/cpu_graph.rs index b44ba233..707c3a8f 100644 --- a/src/canvas/widgets/cpu_graph.rs +++ b/src/canvas/widgets/cpu_graph.rs @@ -346,7 +346,7 @@ impl CpuGraphWidget for Painter { .map(|calculated_width| Constraint::Length(*calculated_width as u16)) .collect::<Vec<_>>()), ) - .header_gap(0), + .header_gap(app_state.app_config_fields.table_gap), draw_loc, ); } diff --git a/src/canvas/widgets/disk_table.rs b/src/canvas/widgets/disk_table.rs index dce61d36..549ae153 100644 --- a/src/canvas/widgets/disk_table.rs +++ b/src/canvas/widgets/disk_table.rs @@ -148,7 +148,7 @@ impl DiskTableWidget for Painter { .map(|calculated_width| Constraint::Length(*calculated_width as u16)) .collect::<Vec<_>>()), ) - .header_gap(0), + .header_gap(app_state.app_config_fields.table_gap), margined_draw_loc[0], ); } diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index 266f20b2..37f6c761 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -265,7 +265,7 @@ impl ProcessTableWidget for Painter { }) .collect::<Vec<_>>()), ) - .header_gap(0), + .header_gap(app_state.app_config_fields.table_gap), margined_draw_loc[0], ); } diff --git a/src/canvas/widgets/temp_table.rs b/src/canvas/widgets/temp_table.rs index 6859d7ad..5fa5e1a2 100644 --- a/src/canvas/widgets/temp_table.rs +++ b/src/canvas/widgets/temp_table.rs @@ -149,7 +149,7 @@ impl TempTableWidget for Painter { .map(|calculated_width| Constraint::Length(*calculated_width as u16)) .collect::<Vec<_>>()), ) - .header_gap(0), + .header_gap(app_state.app_config_fields.table_gap), margined_draw_loc[0], ); } diff --git a/src/main.rs b/src/main.rs index 86c6408b..e9855aec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,8 @@ fn get_matches() -> clap::ArgMatches<'static> { (@arg AUTOHIDE_TIME: --autohide_time "Automatically hide the time scaling in graphs after being shown for a brief moment when zoomed in/out. If time is disabled via --hide_time then this will have no effect.") (@arg DEFAULT_WIDGET_TYPE: --default_widget_type +takes_value "The default widget type to select by default.") (@arg DEFAULT_WIDGET_COUNT: --default_widget_count +takes_value "Which number of the selected widget type to select, from left to right, top to bottom. Defaults to 1.") - (@arg USE_OLD_NETWORK_LEGEND: --use_old_network_legend "Use the old network widget legend.") + (@arg USE_OLD_NETWORK_LEGEND: --use_old_network_legend "Use the older (pre-0.4) network widget legend.") + (@arg HIDE_TABLE_GAP: --hide_table_gap "Hides the spacing between the table headers and entries.") //(@arg TURNED_OFF_CPUS: -t ... +takes_value "Hides CPU data points by default") // TODO: [FEATURE] Enable disabling cores in config/flags ) .get_matches() diff --git a/src/options.rs b/src/options.rs index 86110a49..f2fa00e3 100644 --- a/src/options.rs +++ b/src/options.rs @@ -41,6 +41,7 @@ pub struct ConfigFlags { pub default_widget_type: Option<String>, pub default_widget_count: Option<u64>, pub use_old_network_legend: Option<bool>, + pub hide_table_gap : Option<bool>, //disabled_cpu_cores: Option<Vec<u64>>, // TODO: [FEATURE] Enable disabling cores in config/flags } @@ -218,6 +219,7 @@ pub fn build_app( hide_time: get_hide_time(matches, config), autohide_time, use_old_network_legend: get_use_old_network_legend(matches, config), + table_gap: if get_hide_table_gap(matches, config){0}else{1}, }; let used_widgets = UsedWidgets { @@ -618,3 +620,17 @@ pub fn get_use_old_network_legend(matches: &clap::ArgMatches<'static>, config: & } false } + +pub fn get_hide_table_gap(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { + if matches.is_present("HIDE_TABLE_GAP") { + return true; + } else if let Some(flags) = &config.flags { + if let Some(hide_table_gap) = flags.hide_table_gap { + if hide_table_gap { + return true; + } + } + } + false +} + |