From 2c79256de81f06465092ad2a9b94da679e6ec95a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 30 Jun 2022 17:51:53 +0530 Subject: added episode increment/decrement functionality --- ui/episodes.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/episodes.go b/ui/episodes.go index 277d52f..748482b 100644 --- a/ui/episodes.go +++ b/ui/episodes.go @@ -29,6 +29,12 @@ import ( p "github.com/manifoldco/promptui" ) +// very short name I know +func CreateEpisodeUpdateConfirmationMessage(title string, prevEpNum, epNum int) string { + return fmt.Sprintf("Set Episodes Watched for \x1b[35m%s\x1b[0m from \x1b[1;36m%d\x1b[0m to \x1b[1;33m%d\x1b[0m.", title, prevEpNum, epNum) +} + + 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"}) @@ -60,8 +66,8 @@ func EpisodeInput(anime a.Anime) { os.Exit(1) } - // TODO: read resp and show confirmation message - mal.SetEpisodes(anime.Id, res) + resp := mal.SetEpisodes(anime.Id, epWatchedNum, res) + fmt.Println(CreateEpisodeUpdateConfirmationMessage(anime.Title, epWatchedNum, resp.EpWatched)) } func ChapterInput(manga m.Manga) { @@ -96,5 +102,5 @@ func ChapterInput(manga m.Manga) { } // TODO: read resp and show confirmation message - mal.SetChapters(manga.Id, res) + mal.SetChapters(manga.Id, chReadNum, res) } -- cgit v1.2.3