(homedir string)
| 377 | } |
| 378 | |
| 379 | func parseFishHistory(homedir string) iter.Seq2[string, error] { |
| 380 | lines := readFileToIterator(getFishHistoryPath(homedir)) |
| 381 | return func(yield func(string, error) bool) { |
| 382 | lines(func(line string, err error) bool { |
| 383 | if err != nil { |
| 384 | return yield(line, err) |
| 385 | } |
| 386 | line = strings.TrimSpace(line) |
| 387 | if strings.HasPrefix(line, "- cmd: ") { |
| 388 | yield(strings.SplitN(line, ": ", 2)[1], nil) |
| 389 | } |
| 390 | return true |
| 391 | }) |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | // Concatenate two iterators. |
| 396 | // TODO: Equivalent of the future Go stdlib function iter.Concat2. |
no test coverage detected