aboutsummaryrefslogtreecommitdiff
path: root/cmd/search.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-04 21:09:54 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-04 21:09:54 +0530
commita8c3e33462bc295bd727e39364cfd26e4aa4ea4d (patch)
treeb8caaaac4a661cca819270b5d88b997ea4572c19 /cmd/search.go
parent4879f9849d224849cd9118a68f079bbd917b2b14 (diff)
added --id flag to search and status commands
Diffstat (limited to 'cmd/search.go')
-rw-r--r--cmd/search.go13
1 files changed, 13 insertions, 0 deletions
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)")
}