diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-05 16:28:41 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-05 16:56:08 +0200 |
commit | 1d00ded250102c23c0a106e14d88875d342f7880 (patch) | |
tree | 2d27d6bdbcd74bffeeed48b62e8c046085ecbb94 /cache/identity_excerpt.go | |
parent | 98169d5ad193fe776c29cc40dcd7103bb13e9b7d (diff) | |
download | git-bug-1d00ded250102c23c0a106e14d88875d342f7880.tar.gz |
implement identityExcerpt match method and integrate it into filters
Update docs
Diffstat (limited to 'cache/identity_excerpt.go')
-rw-r--r-- | cache/identity_excerpt.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cache/identity_excerpt.go b/cache/identity_excerpt.go index 2a13bc60..3ac13903 100644 --- a/cache/identity_excerpt.go +++ b/cache/identity_excerpt.go @@ -3,6 +3,7 @@ package cache import ( "encoding/gob" "fmt" + "strings" "github.com/MichaelMure/git-bug/identity" ) @@ -51,6 +52,13 @@ func (i *IdentityExcerpt) DisplayName() string { panic("invalid person data") } +// Match matches a query with the identity name, login and ID prefixes +func (i *IdentityExcerpt) Match(query string) bool { + return strings.HasPrefix(i.Id, query) || + strings.Contains(strings.ToLower(i.Name), query) || + strings.Contains(strings.ToLower(i.Login), query) +} + /* * Sorting */ |