aboutsummaryrefslogtreecommitdiff
path: root/ui/status.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 00:22:46 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 00:22:46 +0530
commit5ad76ed2e6e67b421c27ff153e2ae348152eaa40 (patch)
tree419ff383e201e3427f0b2f300089d8da74142ae1 /ui/status.go
parentaf8701225a83e0521b6f5e5c68aab6b4f0809749 (diff)
added confirmation message and color coding when setting anime status
Diffstat (limited to 'ui/status.go')
-rw-r--r--ui/status.go9
1 files changed, 7 insertions, 2 deletions
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))
}