From 655188566695a74b69b4964081a93dc71f1e1252 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Sun, 2 Feb 2020 23:20:53 -0500 Subject: [PATCH] Update documentation and added more flags for search as per last commit --- README.md | 14 +++++++++++--- src/canvas.rs | 8 +++++--- src/main.rs | 6 ++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7b6e61a3..de928f29 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,11 @@ Run using `btm`. - `-g`, `--group` will group together processes with the same name by default (equivalent to pressing `Tab`). -- `-i`, `--case_insensitive` will default to not matching case +- `-i`, `--case_insensitive` will default to not matching case. + +- `-w`, `--whole` will default to searching for the world word. + +- `-r`, `--regex` will default to using regex. when searching processes. @@ -126,9 +130,13 @@ when searching processes. #### Search Widget -- `Ctrl-p` or `Ctrl-n` to switch between searching for PID and name respectively. +- `Tab` to switch between searching for PID and name respectively. -- `Tab` to toggle whether to ignore case. +- `Alt-c` to toggle ignoring case. + +- `Alt-m` to toggle matching the entire word. + +- `Alt-r` to toggle using regex. - `Ctrl-a` and `Ctrl-e` to jump to the start and end of the search bar respectively. diff --git a/src/canvas.rs b/src/canvas.rs index 962d6d40..b41ca8a6 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -32,7 +32,7 @@ const WINDOWS_NETWORK_HEADERS: [&str; 2] = ["RX", "TX"]; const FORCE_MIN_THRESHOLD: usize = 5; lazy_static! { - static ref HELP_TEXT: [Text<'static>; 20] = [ + static ref HELP_TEXT: [Text<'static>; 22] = [ Text::raw("\nGeneral Keybindings\n"), Text::raw("q, Ctrl-c to quit. Note if you are currently in the search widget, `q` will not work.\n"), Text::raw("Ctrl-r to reset all data.\n"), @@ -52,8 +52,10 @@ lazy_static! { Text::raw("Tab to group together processes with the same name.\n"), Text::raw("Ctrl-f to toggle searching for a process. / to just open it.\n"), Text::raw("Use Ctrl-p and Ctrl-n to toggle between searching for PID and name.\n"), - Text::raw("Use Ctrl-a and Ctrl-e to set the cursor to the start and end of the bar respectively.\n"), - Text::raw("Use Tab to toggle whether to ignore case.\n"), + Text::raw("Use Tab to set the cursor to the start and end of the bar respectively.\n"), + Text::raw("Use Alt-c to toggle whether to ignore case.\n"), + Text::raw("Use Alt-m to toggle matching the entire word.\n"), + Text::raw("Use Alt-r to toggle regex.\n"), Text::raw("\nFor startup flags, type in \"btm -h\".") ]; static ref COLOUR_LIST: Vec = gen_n_colours(constants::NUM_COLOURS); diff --git a/src/main.rs b/src/main.rs index 12c9cc88..54bb5f9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,7 +74,9 @@ fn main() -> error::Result<()> { //(@arg CONFIG_LOCATION: -co --config +takes_value "Sets the location of the config file. Expects a config file in the JSON format.") //(@arg BASIC_MODE: -b --basic "Sets bottom to basic mode, not showing graphs and only showing basic tables.") (@arg GROUP_PROCESSES: -g --group "Groups processes with the same name together on launch.") - (@arg CASE_INSENSITIVE_DEFAULT: -i --case_insensitive "Do not match case when searching processes by default.") + (@arg CASE_INSENSITIVE: -i --case_insensitive "Do not match case when searching by default.") + (@arg WHOLE_WORD: -w --whole "Match whole word when searching by default.") + (@arg REGEX_DEFAULT: -x --regex "Use regex in searching by default.") ) .get_matches(); @@ -132,7 +134,7 @@ fn main() -> error::Result<()> { } // Set default search method - if matches.is_present("CASE_INSENSITIVE_DEFAULT") { + if matches.is_present("CASE_INSENSITIVE") { app.search_state.toggle_ignore_case(); }