aboutsummaryrefslogtreecommitdiff
path: root/mal/episodes.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-15 12:59:22 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-15 12:59:22 +0530
commitab3db8a4ca89293ce0928177e8845d622f13755f (patch)
treee5331856b39b43cfea422f806aa046b0925e92e4 /mal/episodes.go
parent5eb7a3cd41826fccdc432d049dd85a31b4b56073 (diff)
added pretty template for TextInput
Diffstat (limited to 'mal/episodes.go')
-rw-r--r--mal/episodes.go22
1 files changed, 16 insertions, 6 deletions
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 <http://www.gnu.org/licenses/>.
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)
}