From a8c3e33462bc295bd727e39364cfd26e4aa4ea4d Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 4 Jul 2022 21:09:54 +0530 Subject: added --id flag to search and status commands --- cmd/search.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cmd/search.go') diff --git a/cmd/search.go b/cmd/search.go index 92a1b24..0c166b2 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -56,6 +56,12 @@ var searchCmd = &cobra.Command { } func searchManga(searchInput string) { + if entryId > 0 { + selectedManga := mal.GetMangaData(entryId, []string{"my_list_status", "title"}) + fmt.Println("Selected: \x1b[35m" + selectedManga.Title + "\x1b[0m") + ui.MangaActionMenu(selectedManga.MyListStatus.Status != "")(selectedManga) + os.Exit(0) + } if searchInput == "" { searchInput = ui.TextInput("Search Manga: ", "Search can't be blank.") } @@ -66,6 +72,12 @@ func searchManga(searchInput string) { } func searchAnime(searchInput string) { + if entryId > 0 { + selectedAnime := mal.GetAnimeData(entryId, []string{"my_list_status"}) + fmt.Println("Selected: \x1b[35m" + selectedAnime.Title + "\x1b[0m") + ui.AnimeActionMenu(selectedAnime.MyListStatus.Status != "")(selectedAnime) + os.Exit(0) + } if searchInput == "" { searchInput = ui.TextInput("Search Anime: ", "Search can't be blank.") } @@ -83,4 +95,5 @@ func init() { searchCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", 0, "Offset for the search results") searchCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results") searchCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)") + searchCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)") } -- cgit v1.2.3