Skip to content

Commit

Permalink
Ignore case when matching
Browse files Browse the repository at this point in the history
  • Loading branch information
slarwise committed Aug 9, 2024
1 parent 6533bf6 commit 5245a5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ func matchesPrompt(prompt, s string) (bool, int) {
if len(prompt) == 0 {
return true, 0
}
prompt = strings.ToLower(prompt)
s = strings.ToLower(s)
index := 0
consecutive := 0
previousMatched := false
Expand Down
6 changes: 6 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ func TestMatchesPrompt(t *testing.T) {
match: true,
consecutive: 0,
},
"case-insensitive-match": {
prompt: "user",
key: "UsEr",
match: true,
consecutive: 3,
},
"no-match": {
prompt: "asdf",
key: "secret",
Expand Down

0 comments on commit 5245a5d

Please sign in to comment.