mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
refactor: remove redundant newlines
This commit is contained in:
parent
e1a7378386
commit
84f63f2f83
@ -170,7 +170,7 @@ impl Painter {
|
|||||||
// Not required check but it runs only a few times... so whatever ig, prevents me from
|
// Not required check but it runs only a few times... so whatever ig, prevents me from
|
||||||
// being dumb and leaving a help text section only one line long.
|
// being dumb and leaving a help text section only one line long.
|
||||||
if section.len() > 1 {
|
if section.len() > 1 {
|
||||||
styled_help_spans.push(Span::from("\n\n"));
|
styled_help_spans.push(Span::from(""));
|
||||||
styled_help_spans
|
styled_help_spans
|
||||||
.push(Span::styled(section[0], self.colours.table_header_style));
|
.push(Span::styled(section[0], self.colours.table_header_style));
|
||||||
styled_help_spans.extend(
|
styled_help_spans.extend(
|
||||||
|
@ -23,7 +23,7 @@ impl KillDialog for Painter {
|
|||||||
fn get_dd_spans(&self, app_state: &App) -> Option<Text<'_>> {
|
fn get_dd_spans(&self, app_state: &App) -> Option<Text<'_>> {
|
||||||
if let Some(dd_err) = &app_state.dd_err {
|
if let Some(dd_err) = &app_state.dd_err {
|
||||||
return Some(Text::from(Spans::from(format!(
|
return Some(Text::from(Spans::from(format!(
|
||||||
"\nFailure to properly kill the process - {}",
|
"Failure to properly kill the process - {}",
|
||||||
dd_err
|
dd_err
|
||||||
))));
|
))));
|
||||||
} else if let Some(to_kill_processes) = app_state.get_to_delete_processes() {
|
} else if let Some(to_kill_processes) = app_state.get_to_delete_processes() {
|
||||||
@ -34,19 +34,19 @@ impl KillDialog for Painter {
|
|||||||
if app_state.is_grouped(app_state.current_widget.widget_id) {
|
if app_state.is_grouped(app_state.current_widget.widget_id) {
|
||||||
if to_kill_processes.1.len() != 1 {
|
if to_kill_processes.1.len() != 1 {
|
||||||
Span::from(format!(
|
Span::from(format!(
|
||||||
"\nKill {} processes with the name \"{}\"?",
|
"Kill {} processes with the name \"{}\"?",
|
||||||
to_kill_processes.1.len(),
|
to_kill_processes.1.len(),
|
||||||
to_kill_processes.0
|
to_kill_processes.0
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Span::from(format!(
|
Span::from(format!(
|
||||||
"\nKill 1 process with the name \"{}\"?",
|
"Kill 1 process with the name \"{}\"?",
|
||||||
to_kill_processes.0
|
to_kill_processes.0
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Span::from(format!(
|
Span::from(format!(
|
||||||
"\nKill process \"{}\" with PID {}?",
|
"Kill process \"{}\" with PID {}?",
|
||||||
to_kill_processes.0, first_pid
|
to_kill_processes.0, first_pid
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ impl MemBasicWidget for Painter {
|
|||||||
let num_bars_ram = calculate_basic_use_bars(ram_use_percentage, bar_length);
|
let num_bars_ram = calculate_basic_use_bars(ram_use_percentage, bar_length);
|
||||||
let num_bars_swap = calculate_basic_use_bars(swap_use_percentage, bar_length);
|
let num_bars_swap = calculate_basic_use_bars(swap_use_percentage, bar_length);
|
||||||
let mem_label = format!(
|
let mem_label = format!(
|
||||||
"RAM[{}{}{:3.0}%]\n",
|
"RAM[{}{}{:3.0}%]",
|
||||||
"|".repeat(num_bars_ram),
|
"|".repeat(num_bars_ram),
|
||||||
" ".repeat(bar_length - num_bars_ram),
|
" ".repeat(bar_length - num_bars_ram),
|
||||||
ram_use_percentage.round(),
|
ram_use_percentage.round(),
|
||||||
|
@ -44,9 +44,9 @@ impl NetworkBasicWidget for Painter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let rx_label = format!("RX: {}\n", &app_state.canvas_data.rx_display);
|
let rx_label = format!("RX: {}", &app_state.canvas_data.rx_display);
|
||||||
let tx_label = format!("TX: {}", &app_state.canvas_data.tx_display);
|
let tx_label = format!("TX: {}", &app_state.canvas_data.tx_display);
|
||||||
let total_rx_label = format!("Total RX: {}\n", &app_state.canvas_data.total_rx_display);
|
let total_rx_label = format!("Total RX: {}", &app_state.canvas_data.total_rx_display);
|
||||||
let total_tx_label = format!("Total TX: {}", &app_state.canvas_data.total_tx_display);
|
let total_tx_label = format!("Total TX: {}", &app_state.canvas_data.total_tx_display);
|
||||||
|
|
||||||
let net_text = vec![
|
let net_text = vec![
|
||||||
|
172
src/constants.rs
172
src/constants.rs
@ -43,112 +43,112 @@ lazy_static! {
|
|||||||
|
|
||||||
// Help text
|
// Help text
|
||||||
pub const HELP_CONTENTS_TEXT: [&str; 6] = [
|
pub const HELP_CONTENTS_TEXT: [&str; 6] = [
|
||||||
"Press the corresponding numbers to jump to the section, or scroll:\n",
|
"Press the corresponding numbers to jump to the section, or scroll:",
|
||||||
"1 - General\n",
|
"1 - General",
|
||||||
"2 - CPU widget\n",
|
"2 - CPU widget",
|
||||||
"3 - Process widget\n",
|
"3 - Process widget",
|
||||||
"4 - Process search widget\n",
|
"4 - Process search widget",
|
||||||
"5 - Battery widget",
|
"5 - Battery widget",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const GENERAL_HELP_TEXT: [&str; 29] = [
|
pub const GENERAL_HELP_TEXT: [&str; 29] = [
|
||||||
"1 - General\n",
|
"1 - General",
|
||||||
"q, Ctrl-c Quit\n",
|
"q, Ctrl-c Quit",
|
||||||
"Esc Close dialog windows, search, widgets, or exit expanded mode\n",
|
"Esc Close dialog windows, search, widgets, or exit expanded mode",
|
||||||
"Ctrl-r Reset display and any collected data\n",
|
"Ctrl-r Reset display and any collected data",
|
||||||
"f Freeze/unfreeze updating with new data\n",
|
"f Freeze/unfreeze updating with new data",
|
||||||
"Ctrl-Left, \n",
|
"Ctrl-Left, ",
|
||||||
"Shift-Left, Move widget selection left\n",
|
"Shift-Left, Move widget selection left",
|
||||||
"H, A \n",
|
"H, A ",
|
||||||
"Ctrl-Right, \n",
|
"Ctrl-Right, ",
|
||||||
"Shift-Right, Move widget selection right\n",
|
"Shift-Right, Move widget selection right",
|
||||||
"L, D \n",
|
"L, D ",
|
||||||
"Ctrl-Up, \n",
|
"Ctrl-Up, ",
|
||||||
"Shift-Up, Move widget selection up\n",
|
"Shift-Up, Move widget selection up",
|
||||||
"K, W \n",
|
"K, W ",
|
||||||
"Ctrl-Down, \n",
|
"Ctrl-Down, ",
|
||||||
"Shift-Down, Move widget selection down\n",
|
"Shift-Down, Move widget selection down",
|
||||||
"J, S \n",
|
"J, S ",
|
||||||
"Left, h Move left within widget\n",
|
"Left, h Move left within widget",
|
||||||
"Down, j Move down within widget\n",
|
"Down, j Move down within widget",
|
||||||
"Up, k Move up within widget\n",
|
"Up, k Move up within widget",
|
||||||
"Right, l Move right within widget\n",
|
"Right, l Move right within widget",
|
||||||
"? Open help menu\n",
|
"? Open help menu",
|
||||||
"gg Jump to the first entry\n",
|
"gg Jump to the first entry",
|
||||||
"G Jump to the last entry\n",
|
"G Jump to the last entry",
|
||||||
"e Expand the currently selected widget\n",
|
"e Expand the currently selected widget",
|
||||||
"+ Zoom in on chart (decrease time range)\n",
|
"+ Zoom in on chart (decrease time range)",
|
||||||
"- Zoom out on chart (increase time range)\n",
|
"- Zoom out on chart (increase time range)",
|
||||||
"= Reset zoom\n",
|
"= Reset zoom",
|
||||||
"Mouse scroll Scroll through the tables or zoom in/out of charts by scrolling up/down",
|
"Mouse scroll Scroll through the tables or zoom in/out of charts by scrolling up/down",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const CPU_HELP_TEXT: [&str; 2] = [
|
pub const CPU_HELP_TEXT: [&str; 2] = [
|
||||||
"2 - CPU widget\n",
|
"2 - CPU widget",
|
||||||
"Mouse scroll Scrolling over an CPU core/average shows only that entry on the chart",
|
"Mouse scroll Scrolling over an CPU core/average shows only that entry on the chart",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const PROCESS_HELP_TEXT: [&str; 9] = [
|
pub const PROCESS_HELP_TEXT: [&str; 9] = [
|
||||||
"3 - Process widget\n",
|
"3 - Process widget",
|
||||||
"dd Kill the selected process\n",
|
"dd Kill the selected process",
|
||||||
"c Sort by CPU usage, press again to reverse sorting order\n",
|
"c Sort by CPU usage, press again to reverse sorting order",
|
||||||
"m Sort by memory usage, press again to reverse sorting order\n",
|
"m Sort by memory usage, press again to reverse sorting order",
|
||||||
"p Sort by PID name, press again to reverse sorting order\n",
|
"p Sort by PID name, press again to reverse sorting order",
|
||||||
"n Sort by process name, press again to reverse sorting order\n",
|
"n Sort by process name, press again to reverse sorting order",
|
||||||
"Tab Group/un-group processes with the same name\n",
|
"Tab Group/un-group processes with the same name",
|
||||||
"Ctrl-f, / Open process search widget\n",
|
"Ctrl-f, / Open process search widget",
|
||||||
"P Toggle between showing the full path or just the process name",
|
"P Toggle between showing the full path or just the process name",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const SEARCH_HELP_TEXT: [&str; 43] = [
|
pub const SEARCH_HELP_TEXT: [&str; 43] = [
|
||||||
"4 - Process search widget\n",
|
"4 - Process search widget",
|
||||||
"Tab Toggle between searching for PID and name\n",
|
"Tab Toggle between searching for PID and name",
|
||||||
"Esc Close the search widget (retains the filter)\n",
|
"Esc Close the search widget (retains the filter)",
|
||||||
"Ctrl-a Skip to the start of the search query\n",
|
"Ctrl-a Skip to the start of the search query",
|
||||||
"Ctrl-e Skip to the end of the search query\n",
|
"Ctrl-e Skip to the end of the search query",
|
||||||
"Ctrl-u Clear the current search query\n",
|
"Ctrl-u Clear the current search query",
|
||||||
"Backspace Delete the character behind the cursor\n",
|
"Backspace Delete the character behind the cursor",
|
||||||
"Delete Delete the character at the cursor\n",
|
"Delete Delete the character at the cursor",
|
||||||
"Alt-c/F1 Toggle matching case\n",
|
"Alt-c/F1 Toggle matching case",
|
||||||
"Alt-w/F2 Toggle matching the entire word\n",
|
"Alt-w/F2 Toggle matching the entire word",
|
||||||
"Alt-r/F3 Toggle using regex\n",
|
"Alt-r/F3 Toggle using regex",
|
||||||
"Left, Alt-h Move cursor left\n",
|
"Left, Alt-h Move cursor left",
|
||||||
"Right, Alt-l Move cursor right\n",
|
"Right, Alt-l Move cursor right",
|
||||||
"\n",
|
"",
|
||||||
"Search keywords:\n",
|
"Search keywords:",
|
||||||
"pid ex: pid 825\n",
|
"pid ex: pid 825",
|
||||||
"cpu ex: cpu > 4.2\n",
|
"cpu ex: cpu > 4.2",
|
||||||
"mem ex: mem < 4.2\n",
|
"mem ex: mem < 4.2",
|
||||||
"read ex: read >= 1 b\n",
|
"read ex: read >= 1 b",
|
||||||
"write ex: write <= 1 tb\n",
|
"write ex: write <= 1 tb",
|
||||||
"tread ex: tread = 1\n",
|
"tread ex: tread = 1",
|
||||||
"twrite ex: twrite = 1\n",
|
"twrite ex: twrite = 1",
|
||||||
"\n",
|
"",
|
||||||
"Comparison operators:\n",
|
"Comparison operators:",
|
||||||
"= ex: cpu = 1\n",
|
"= ex: cpu = 1",
|
||||||
"> ex: cpu > 1\n",
|
"> ex: cpu > 1",
|
||||||
"< ex: cpu < 1\n",
|
"< ex: cpu < 1",
|
||||||
">= ex: cpu >= 1\n",
|
">= ex: cpu >= 1",
|
||||||
"<= ex: cpu <= 1\n",
|
"<= ex: cpu <= 1",
|
||||||
"\n",
|
"",
|
||||||
"Logical operators:\n",
|
"Logical operators:",
|
||||||
"and/&&/<Space> ex: btm and cpu > 1 and mem > 1\n",
|
"and/&&/<Space> ex: btm and cpu > 1 and mem > 1",
|
||||||
"or/|| ex: btm or firefox\n",
|
"or/|| ex: btm or firefox",
|
||||||
"\n",
|
"",
|
||||||
"Supported units:\n",
|
"Supported units:",
|
||||||
"B ex: read > 1 b\n",
|
"B ex: read > 1 b",
|
||||||
"KB ex: read > 1 kb\n",
|
"KB ex: read > 1 kb",
|
||||||
"MB ex: read > 1 mb\n",
|
"MB ex: read > 1 mb",
|
||||||
"TB ex: read > 1 tb\n",
|
"TB ex: read > 1 tb",
|
||||||
"KiB ex: read > 1 kib\n",
|
"KiB ex: read > 1 kib",
|
||||||
"MiB ex: read > 1 mib\n",
|
"MiB ex: read > 1 mib",
|
||||||
"GiB ex: read > 1 gib\n",
|
"GiB ex: read > 1 gib",
|
||||||
"TiB ex: read > 1 tib",
|
"TiB ex: read > 1 tib",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const BATTERY_HELP_TEXT: [&str; 3] = [
|
pub const BATTERY_HELP_TEXT: [&str; 3] = [
|
||||||
"5 - Battery widget\n",
|
"5 - Battery widget",
|
||||||
"Left Go to previous battery\n",
|
"Left Go to previous battery",
|
||||||
"Right Go to next battery",
|
"Right Go to next battery",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user