summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClementTsang <cjhtsang@uwaterloo.ca>2020-02-02 23:23:39 -0500
committerClementTsang <cjhtsang@uwaterloo.ca>2020-02-02 23:25:15 -0500
commit616ba01be0804b62918e4d3ea49695beb81ed784 (patch)
treeec8f4a4bad6bc9cd6677829c1def3179b0b2b666 /src
parent655188566695a74b69b4964081a93dc71f1e1252 (diff)
Added flag functionality, made case insensitive default from now on
Diffstat (limited to 'src')
-rw-r--r--src/app.rs2
-rw-r--r--src/main.rs12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/app.rs b/src/app.rs
index 455b3437..f33125f2 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -62,7 +62,7 @@ impl Default for AppSearchState {
AppSearchState {
current_search_query: String::default(),
searching_pid: false,
- ignore_case: false,
+ ignore_case: true,
current_regex: BASE_REGEX.clone(),
current_cursor_position: 0,
match_word: false,
diff --git a/src/main.rs b/src/main.rs
index 54bb5f9f..9fb6b4c6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -74,7 +74,7 @@ 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: -i --case_insensitive "Do not match case when searching by default.")
+ (@arg CASE_SENSITIVE: -s --case_sensitive "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.")
)
@@ -134,10 +134,18 @@ fn main() -> error::Result<()> {
}
// Set default search method
- if matches.is_present("CASE_INSENSITIVE") {
+ if matches.is_present("CASE_SENSITIVE") {
app.search_state.toggle_ignore_case();
}
+ if matches.is_present("WHOLE_WORD") {
+ app.search_state.toggle_search_whole_word();
+ }
+
+ if matches.is_present("REGEX_DEFAULT") {
+ app.search_state.toggle_search_regex();
+ }
+
// Set up up tui and crossterm
let mut stdout_val = stdout();
enable_raw_mode()?;