MCPcopy
hub / github.com/ddworken/hishtory / parseFishHistory

Function parseFishHistory

client/lib/lib.go:379–393  ·  view source on GitHub ↗
(homedir string)

Source from the content-addressed store, hash-verified

377}
378
379func 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.

Callers 1

ImportHistoryFunction · 0.85

Calls 2

readFileToIteratorFunction · 0.85
getFishHistoryPathFunction · 0.85

Tested by

no test coverage detected