From d7a820b1115a3765daecf05b13a8caa94f432e85 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 14 Aug 2022 21:06:32 +0530 Subject: reading auth token from flags --- mal/mal.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mal/mal.go') diff --git a/mal/mal.go b/mal/mal.go index cb9665e..77940df 100644 --- a/mal/mal.go +++ b/mal/mal.go @@ -28,6 +28,7 @@ import ( ) var ( + Secret string animeClient a.Client mangaClient m.Client userClient u.Client @@ -40,8 +41,10 @@ var ( // init() would kill the program prematurely on `macli login` command func Init() { - secret := auth.GetToken() - tk := "Bearer " + secret + if Secret == "" { + Secret = auth.GetToken() + } + tk := "Bearer " + Secret // initialise MAL2Go Client(s) animeClient.AuthToken = tk -- cgit v1.2.3