Slide 29
Slide 29 text
func main() {
idx, err := fuzzyfinder.FindMulti(songs, func(i int) string {
return songs[i].Title
}, fuzzyfinder.WithPreviewWindow(func(i, w, h int) string {
if i == -1 {
return ""
}
return fmt.Sprintf(
"Title: %s\nArtist: %s\nAlbum: %s\n",
songs[i].Title, songs[i].ArtistName, songs[i].AlbumName)
}))
if err != nil {
fmt.Fprintf(os.Stderr, "failed to find: %s\n", err)
os.Exit(1)
}
for _, i := range idx {
fmt.Println(fmt.Sprintf(
"%s / %s / %s",
songs[i].Title, songs[i].ArtistName, songs[i].AlbumName))
}
}