aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 20:15:05 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 20:15:05 +0530
commita3a7b41179d8abe9edc705db6b14063e95c459fa (patch)
tree935506bc5ddf9c6a28b45b619b370178f1dc13d4 /ui
parent599139984e50d769bb97332ed5a327cf6d41ba37 (diff)
added --query option to episodes and chapters command
Diffstat (limited to 'ui')
-rw-r--r--ui/episodes.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/ui/episodes.go b/ui/episodes.go
index edf05a4..8b1bcff 100644
--- a/ui/episodes.go
+++ b/ui/episodes.go
@@ -39,10 +39,8 @@ func CreateChapterUpdateConfirmationMessage(title string, prevChNum, chNum int)
}
func EpisodeInput(anime a.Anime) {
- // fetch number of total episodes, number of watched episodes from the API
- animeData := mal.GetAnimeData(anime.Id, []string{"num_episodes", "my_list_status"})
- epWatchedNum := animeData.MyListStatus.EpWatched
- epTotalNum := animeData.NumEpisodes
+ epWatchedNum := anime.MyListStatus.EpWatched
+ epTotalNum := anime.NumEpisodes
validate := func(input string) error {
if _, err := strconv.ParseFloat(input, 64); err != nil {
@@ -74,10 +72,8 @@ func EpisodeInput(anime a.Anime) {
}
func ChapterInput(manga m.Manga) {
- // fetch number of total chapters, number of read chapters from the API
- animeData := mal.GetMangaData(manga.Id, []string{"num_chapters", "my_list_status"})
- chReadNum := animeData.MyListStatus.ChaptersRead
- chTotalNum := animeData.NumChapters
+ chReadNum := manga.MyListStatus.ChaptersRead
+ chTotalNum := manga.NumChapters
validate := func(input string) error {
if _, err := strconv.ParseFloat(input, 64); err != nil {
@@ -104,6 +100,6 @@ func ChapterInput(manga m.Manga) {
os.Exit(1)
}
- // TODO: read resp and show confirmation message
- mal.SetChapters(manga.Id, chReadNum, res)
+ resp := mal.SetChapters(manga.Id, chReadNum, res)
+ fmt.Println(CreateChapterUpdateConfirmationMessage(manga.Title, chReadNum, resp.ChaptersRead))
}