mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-23 02:15:12 +00:00
feat: add option to filter commits in a case insensitive way
This commit is contained in:
parent
a94e3f9a80
commit
72fb3eac14
9 changed files with 88 additions and 26 deletions
|
|
@ -1,6 +1,10 @@
|
|||
package chglog
|
||||
|
||||
func commitFilter(commits []*Commit, filters map[string][]string) []*Commit {
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func commitFilter(commits []*Commit, filters map[string][]string, noCaseSensitive bool) []*Commit {
|
||||
res := []*Commit{}
|
||||
|
||||
for _, commit := range commits {
|
||||
|
|
@ -23,9 +27,17 @@ func commitFilter(commits []*Commit, filters map[string][]string) []*Commit {
|
|||
break
|
||||
}
|
||||
|
||||
if noCaseSensitive {
|
||||
str = strings.ToLower(str)
|
||||
}
|
||||
|
||||
exist := false
|
||||
|
||||
for _, val := range values {
|
||||
if noCaseSensitive {
|
||||
val = strings.ToLower(val)
|
||||
}
|
||||
|
||||
if str == val {
|
||||
exist = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue