Skip to content

Commit

Permalink
Update documentation and added more flags for search as per last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Feb 3, 2020
1 parent fc3a2e6 commit 6551885
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

- `Alt-c` to toggle ignoring case.

- `Alt-m` to toggle matching the entire word.

- `Tab` to toggle whether to ignore case.
- `Alt-r` to toggle using regex.

- `Ctrl-a` and `Ctrl-e` to jump to the start and end of the search bar respectively.

Expand Down
8 changes: 5 additions & 3 deletions src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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<Color> = gen_n_colours(constants::NUM_COLOURS);
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 6551885

Please sign in to comment.