From d28ed19d99f757cd898ee47925bbc9aa4f428125 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 30 Jun 2022 23:20:36 +0530 Subject: Bug Fix: search results not showing all required data --- cmd/search.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'cmd/search.go') diff --git a/cmd/search.go b/cmd/search.go index 89ab17f..63f451a 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -19,11 +19,13 @@ along with this program. If not, see . package cmd import ( - "os" "fmt" + "os" "strings" - "github.com/spf13/cobra" + + "github.com/MikunoNaka/macli/mal" "github.com/MikunoNaka/macli/ui" + "github.com/spf13/cobra" ) var searchCmd = &cobra.Command { @@ -57,8 +59,9 @@ func searchManga(searchInput string) { searchInput = ui.TextInput("Search Manga: ", "Search can't be blank.") } manga := ui.MangaSearch("Select Manga:", searchInput) - mangaIsAdded := manga.MyListStatus.Status != "" - ui.MangaActionMenu(mangaIsAdded)(manga) + selectedManga := mal.GetMangaData(manga.Id, []string{"my_list_status", "num_chapters"}) + mangaIsAdded := selectedManga.MyListStatus.Status != "" + ui.MangaActionMenu(mangaIsAdded)(selectedManga) } func searchAnime(searchInput string) { @@ -66,8 +69,9 @@ func searchAnime(searchInput string) { searchInput = ui.TextInput("Search Anime: ", "Search can't be blank.") } anime := ui.AnimeSearch("Select Anime:", searchInput) - animeIsAdded := anime.MyListStatus.Status != "" - ui.AnimeActionMenu(animeIsAdded)(anime) + selectedAnime := mal.GetAnimeData(anime.Id, []string{"my_list_status", "num_episodes"}) + animeIsAdded := selectedAnime.MyListStatus.Status != "" + ui.AnimeActionMenu(animeIsAdded)(selectedAnime) } func init() { -- cgit v1.2.3