findExactMatch tries ID match (case-sensitive), then title match (case-insensitive).
(query string, tasks []*model.Task)
| 187 | |
| 188 | // findExactMatch tries ID match (case-sensitive), then title match (case-insensitive). |
| 189 | func findExactMatch(query string, tasks []*model.Task) *model.Task { |
| 190 | for _, t := range tasks { |
| 191 | if t.ID == query { |
| 192 | return t |
| 193 | } |
| 194 | } |
| 195 | lowerQuery := strings.ToLower(query) |
| 196 | for _, t := range tasks { |
| 197 | if strings.ToLower(t.Title) == lowerQuery { |
| 198 | return t |
| 199 | } |
| 200 | } |
| 201 | return nil |
| 202 | } |
| 203 | |
| 204 | // findFilePathMatch tries to match the query against task file paths and filenames. |
| 205 | func findFilePathMatch(query string, tasks []*model.Task) (*model.Task, error) { |
no outgoing calls