diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-07-04 22:18:49 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-07-04 22:18:49 +0530 |
commit | 2689541cbbba044153c33fb1b36d691514916139 (patch) | |
tree | c7274666127b8a038b885353c541c14f32dfa264 /ui | |
parent | 2bb89f25599f48c4953801298c4f9ef8dee12246 (diff) |
added --id flag to search and episodes and chapters command
Diffstat (limited to 'ui')
-rw-r--r-- | ui/episodes.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/episodes.go b/ui/episodes.go index 21c0078..04ff53e 100644 --- a/ui/episodes.go +++ b/ui/episodes.go @@ -30,12 +30,18 @@ import ( ) // very short name I know -func CreateEpisodeUpdateConfirmationMessage(title string, prevEpNum, epNum int) string { - return fmt.Sprintf("\x1b[35m%s\x1b[0m Episodes Watched :: \x1b[1;33m%d\x1b[0m -> \x1b[1;36m%d\x1b[0m", title, prevEpNum, epNum) +func CreateEpisodeUpdateConfirmationMessage(title string, epNum, prevEpNum int) string { + if prevEpNum >= 0 { + return fmt.Sprintf("\x1b[35m%s\x1b[0m Episodes Watched :: \x1b[1;33m%d\x1b[0m -> \x1b[1;36m%d\x1b[0m", title, prevEpNum, epNum) + } + return fmt.Sprintf("\x1b[35m%s\x1b[0m Episodes Watched :: \x1b[1;36m%d\x1b[0m", title, epNum) } -func CreateChapterUpdateConfirmationMessage(title string, prevChNum, chNum int) string { - return fmt.Sprintf("\x1b[35m%s\x1b[0m Chapters Read :: \x1b[1;33m%d\x1b[0m -> \x1b[1;36m%d\x1b[0m", title, prevChNum, chNum) +func CreateChapterUpdateConfirmationMessage(title string, chNum, prevChNum int) string { + if prevChNum >= 0 { + return fmt.Sprintf("\x1b[35m%s\x1b[0m Chapters Read :: \x1b[1;33m%d\x1b[0m -> \x1b[1;36m%d\x1b[0m", title, prevChNum, chNum) + } + return fmt.Sprintf("\x1b[35m%s\x1b[0m Chapters Read :: \x1b[1;36m%d\x1b[0m", title, chNum) } func EpisodeInput(anime a.Anime) { @@ -68,7 +74,7 @@ func EpisodeInput(anime a.Anime) { } resp := mal.SetEpisodes(anime.Id, epWatchedNum, res) - fmt.Println(CreateEpisodeUpdateConfirmationMessage(anime.Title, epWatchedNum, resp.EpWatched)) + fmt.Println(CreateEpisodeUpdateConfirmationMessage(anime.Title, resp.EpWatched, epWatchedNum)) } func ChapterInput(manga m.Manga) { @@ -101,5 +107,5 @@ func ChapterInput(manga m.Manga) { } resp := mal.SetChapters(manga.Id, chReadNum, res) - fmt.Println(CreateChapterUpdateConfirmationMessage(manga.Title, chReadNum, resp.ChaptersRead)) + fmt.Println(CreateEpisodeUpdateConfirmationMessage(manga.Title, resp.ChaptersRead, chReadNum)) } |