From 5ad76ed2e6e67b421c27ff153e2ae348152eaa40 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 30 Jun 2022 00:22:46 +0530 Subject: added confirmation message and color coding when setting anime status --- ui/status.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ui/status.go') 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)) } -- cgit v1.2.3