aboutsummaryrefslogtreecommitdiff
path: root/mal
diff options
context:
space:
mode:
Diffstat (limited to 'mal')
-rw-r--r--mal/episodes.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/mal/episodes.go b/mal/episodes.go
index c0ac116..06bb7a0 100644
--- a/mal/episodes.go
+++ b/mal/episodes.go
@@ -50,18 +50,20 @@ func SetEpisodes(animeId, prevValue int, ep string) a.UpdateResponse {
return res
}
-
func SetChapters(mangaId, prevValue int, ch string) m.UpdateResponse {
- chValue, err := strconv.Atoi(ch)
+ chInt, err := strconv.Atoi(ch)
if err != nil {
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)
+ var chValue int
+ switch ch[0:1] {
+ case "+", "-":
+ // works both for increment and decrement
+ chValue = prevValue + chInt
+ default:
+ chValue = chInt
}
res, err := userMangaClient.SetChaptersRead(mangaId, chValue)