diff options
-rw-r--r-- | cmd/status.go | 8 | ||||
-rw-r--r-- | ui/status.go | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/cmd/status.go b/cmd/status.go index feb5c10..dcf177c 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -68,8 +68,8 @@ func setAnimeStatus(statusInput, searchInput string) { if statusInput == "" { ui.AnimeStatusMenu(anime) } else { - mal.SetAnimeStatus(anime.Id, statusInput) - fmt.Printf("Successfully set \"%s\" to \"%s\"\n", anime.Title, statusInput) + resp := mal.SetAnimeStatus(anime.Id, statusInput) + fmt.Println(ui.CreateStatusUpdateConfirmationMessage(anime.Title, resp.Status)) } } @@ -83,8 +83,8 @@ func setMangaStatus(statusInput, searchInput string) { if statusInput == "" { ui.MangaStatusMenu(manga) } else { - mal.SetAnimeStatus(manga.Id, statusInput) - fmt.Printf("Successfully set \"%s\" to \"%s\"\n", manga.Title, statusInput) + resp := mal.SetAnimeStatus(manga.Id, statusInput) + fmt.Println(ui.CreateStatusUpdateConfirmationMessage(manga.Title, resp.Status)) } } diff --git a/ui/status.go b/ui/status.go index 2b3894a..d1a40c3 100644 --- a/ui/status.go +++ b/ui/status.go @@ -51,6 +51,11 @@ func getColorCodeByStatus(status string) string { } } +// very short name I know +func CreateStatusUpdateConfirmationMessage(title, status string) string { + return "Set \x1b[35m" + title + "\x1b[0m status to " + getColorCodeByStatus(status) + status + "\x1b[0m" +} + func AnimeStatusMenu(anime a.Anime) { options := []StatusOption { {"Watching", "watching"}, @@ -104,7 +109,7 @@ func AnimeStatusMenu(anime a.Anime) { } resp := mal.SetAnimeStatus(anime.Id, options[res].Status) - fmt.Println("Set \x1b[35m" + anime.Title + "\x1b[0m status to " + getColorCodeByStatus(resp.Status) + resp.Status + "\x1b[0m") + fmt.Println(CreateStatusUpdateConfirmationMessage(anime.Title, resp.Status)) } func MangaStatusMenu(manga m.Manga) { @@ -160,5 +165,5 @@ func MangaStatusMenu(manga m.Manga) { } resp := mal.SetMangaStatus(manga.Id, options[res].Status) - fmt.Println("Set \x1b[35m" + manga.Title + "\x1b[0m status to " + getColorCodeByStatus(resp.Status) + resp.Status + "\x1b[0m") + fmt.Println(CreateStatusUpdateConfirmationMessage(manga.Title, resp.Status)) } |