aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-09 20:14:52 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-09 20:14:52 +0200
commit13797c3b77b9e44860b47d381c9451d8ab70b14d (patch)
treece61c848338c669a3bfcc7112c0b4a6e15ec4605 /bug
parent877f3bc21ef6bb1ae636caaad8f62733f6de2f72 (diff)
downloadgit-bug-13797c3b77b9e44860b47d381c9451d8ab70b14d.tar.gz
person: add a function to test the matching of a query
Diffstat (limited to 'bug')
-rw-r--r--bug/person.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/bug/person.go b/bug/person.go
index 674da9f2..9afaac0d 100644
--- a/bug/person.go
+++ b/bug/person.go
@@ -2,6 +2,7 @@ package bug
import (
"errors"
+ "strings"
"github.com/MichaelMure/git-bug/repository"
)
@@ -31,3 +32,8 @@ func GetUser(repo repository.Repo) (Person, error) {
return Person{Name: name, Email: email}, nil
}
+
+// Match tell is the Person match the given query string
+func (p Person) Match(query string) bool {
+ return strings.Contains(strings.ToLower(p.Name), strings.ToLower(query))
+}