diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-09 20:14:52 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-09 20:14:52 +0200 |
commit | 13797c3b77b9e44860b47d381c9451d8ab70b14d (patch) | |
tree | ce61c848338c669a3bfcc7112c0b4a6e15ec4605 /bug | |
parent | 877f3bc21ef6bb1ae636caaad8f62733f6de2f72 (diff) | |
download | git-bug-13797c3b77b9e44860b47d381c9451d8ab70b14d.tar.gz |
person: add a function to test the matching of a query
Diffstat (limited to 'bug')
-rw-r--r-- | bug/person.go | 6 |
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)) +} |