From 720045d9ea2e612ca0f0b7333ee62a73b2955a15 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 2 Jul 2022 14:41:18 +0530 Subject: Bug Fix: `macli login` showing error message that user is not logged in --- cmd/chapters.go | 1 + cmd/episodes.go | 1 + cmd/score.go | 1 + cmd/search.go | 1 + cmd/status.go | 1 + cmd/user_info.go | 1 + 6 files changed, 6 insertions(+) (limited to 'cmd') diff --git a/cmd/chapters.go b/cmd/chapters.go index 26d947b..ae2596f 100644 --- a/cmd/chapters.go +++ b/cmd/chapters.go @@ -40,6 +40,7 @@ var chaptersCmd = &cobra.Command{ " - \x1b[33m`macli chapters -s +1 `\x1b[0m to increment the chapters by 1\n" + " - \x1b[33m`macli chapters -s -2 `\x1b[0m to decrement the chapters by 2\n", Run: func(cmd *cobra.Command, args []string) { + mal.Init() searchInput := strings.Join(args, " ") if searchInput == "" { var promptText string diff --git a/cmd/episodes.go b/cmd/episodes.go index 05591cd..df5c960 100644 --- a/cmd/episodes.go +++ b/cmd/episodes.go @@ -40,6 +40,7 @@ var episodesCmd = &cobra.Command{ " - \x1b[33m`macli episodes -s +1 `\x1b[0m to increment the episodes by 1\n" + " - \x1b[33m`macli episodes -s -2 `\x1b[0m to decrement the episodes by 2\n", Run: func(cmd *cobra.Command, args []string) { + mal.Init() searchInput := strings.Join(args, " ") if searchInput == "" { var promptText string diff --git a/cmd/score.go b/cmd/score.go index d22f4d2..f97de87 100644 --- a/cmd/score.go +++ b/cmd/score.go @@ -38,6 +38,7 @@ var scoreCmd = &cobra.Command{ " - \x1b[33m`macli status `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + " - \x1b[33m`macli status -s \x1b[34mwatching|plan_to_watch|dropped|on_hold|completed\x1b[33m `\x1b[0m to specify status from command\n", Run: func(cmd *cobra.Command, args []string) { + mal.Init() searchInput := strings.Join(args, " ") scoreInput, err := cmd.Flags().GetInt("set-value") diff --git a/cmd/search.go b/cmd/search.go index 63f451a..969af8f 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -38,6 +38,7 @@ var searchCmd = &cobra.Command { "\t\x1b[33m`macli search -m `\x1b[0m searches for a manga\n" + "\t\x1b[33m`macli search`\x1b[0m interactively asks for an anime to search for (same for manga with -m/--manga flag)\n", Run: func(cmd *cobra.Command, args []string) { + mal.Init() // read searchInput from command searchInput := strings.Join(args, " ") mangaMode, err := cmd.Flags().GetBool("manga") diff --git a/cmd/status.go b/cmd/status.go index 05b9dc4..e412a96 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -38,6 +38,7 @@ var statusCmd = &cobra.Command{ " - \x1b[33m`macli status `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + " - \x1b[33m`macli status -s \x1b[34mwatching|plan_to_watch|dropped|on_hold|completed\x1b[33m `\x1b[0m to specify status from command\n", Run: func(cmd *cobra.Command, args []string) { + mal.Init() searchInput := strings.Join(args, " ") statusInput, err := cmd.Flags().GetString("set-value") diff --git a/cmd/user_info.go b/cmd/user_info.go index 8b6463e..b83af8b 100644 --- a/cmd/user_info.go +++ b/cmd/user_info.go @@ -32,6 +32,7 @@ var userInfoCmd = &cobra.Command { Currently, MyAnimeList doesn't allow reading of other users' profiles. `, Run: func(cmd *cobra.Command, args []string) { + mal.Init() userInfo := mal.GetUserInfo() fmt.Printf("\x1b[1;34mUsername: \x1b[0m%s\n", userInfo.Name) -- cgit v1.2.3