From ab3db8a4ca89293ce0928177e8845d622f13755f Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 15 Jun 2022 12:59:22 +0530 Subject: added pretty template for TextInput --- mal/episodes.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'mal/episodes.go') diff --git a/mal/episodes.go b/mal/episodes.go index 30fc5d2..255f8b0 100644 --- a/mal/episodes.go +++ b/mal/episodes.go @@ -19,30 +19,40 @@ along with this program. If not, see . package mal import ( - "log" + "fmt" + "os" "strconv" ) func SetEpisodes(animeId int, ep string) { epValue, err := strconv.Atoi(ep) if err != nil { - log.Fatal("Error while parsing episode input", err) + fmt.Println("Error while parsing episode input", err) + os.Exit(1) } sign := ep[0:1] if sign == "+" || sign == "-" { - log.Printf("Cannot increment/decrement watched episodes by %d\n. Currently that doesn't wokr", epValue) - return + fmt.Printf("Cannot increment/decrement watched episodes by %d\n. Currently that doesn't wokr", epValue) + os.Exit(2) } userAnimeClient.SetWatchedEpisodes(animeId, epValue) } + func SetChapters(mangaId int, ch string) { chValue, err := strconv.Atoi(ch) if err != nil { - log.Fatal("Error while parsing chapter input", err) + fmt.Println("Error while parsing chapter input", err) + os.Exit(1) + } + + sign := ch[0:1] + if sign == "+" || sign == "-" { + fmt.Printf("Cannot increment/decrement read chapters by %d\n. Currently that doesn't wokr", chValue) + os.Exit(2) } - log.Printf("peeepee%s%d", ch[0:1], chValue) + userMangaClient.SetChaptersRead(mangaId, chValue) } -- cgit v1.2.3