mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
Add DoesNotContainAnyOf matcher
This commit is contained in:
parent
572d1b5920
commit
ea532b4729
@ -39,6 +39,18 @@ func (self *TextMatcher) DoesNotContain(target string) *TextMatcher {
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *TextMatcher) DoesNotContainAnyOf(targets []string) *TextMatcher {
|
||||
self.appendRule(matcherRule[string]{
|
||||
name: fmt.Sprintf("does not contain any of '%s'", targets),
|
||||
testFn: func(value string) (bool, string) {
|
||||
return lo.NoneBy(targets, func(target string) bool { return strings.Contains(value, target) }),
|
||||
fmt.Sprintf("Expected none of '%s' to be found in '%s'", targets, value)
|
||||
},
|
||||
})
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *TextMatcher) MatchesRegexp(target string) *TextMatcher {
|
||||
self.appendRule(matcherRule[string]{
|
||||
name: fmt.Sprintf("matches regular expression '%s'", target),
|
||||
@ -107,6 +119,10 @@ func DoesNotContain(target string) *TextMatcher {
|
||||
return AnyString().DoesNotContain(target)
|
||||
}
|
||||
|
||||
func DoesNotContainAnyOf(targets ...string) *TextMatcher {
|
||||
return AnyString().DoesNotContainAnyOf(targets)
|
||||
}
|
||||
|
||||
func MatchesRegexp(target string) *TextMatcher {
|
||||
return AnyString().MatchesRegexp(target)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user