Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-08-27 00:05:08 +02:00
commit 624a723b16
29 changed files with 1989 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package creds
import (
"fmt"
"strings"
)
type Entry struct {
Manufacturer string
Name string
Icon string
Tags []string
Version string
User string
Pass string
Comment string
}
func (e Entry) Title() string { return e.Name }
func (e Entry) Description() string { return fmt.Sprintf("%s %s", e.Manufacturer, e.Version) }
func (e Entry) FilterValue() string { return e.searchString() }
func (e Entry) searchString() string {
return strings.ToLower(strings.Join([]string{
e.Manufacturer, e.Name, e.Comment, strings.Join(e.Tags, " "),
}, " "))
}
func (e Entry) matches(tokens []string) bool {
s := e.searchString()
for _, t := range tokens {
if !strings.Contains(s, t) {
return false
}
}
return true
}
func queryTokens(query string) []string {
return strings.Fields(strings.ToLower(strings.TrimSpace(query)))
}