From 551b158d207d99d439cad39b512a21a6e8bd0c54 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 30 Jun 2022 20:42:30 +0530 Subject: added --query option to status command and fixed bug while setting manga status (it calls SetAnimeStatus instead) --- ui/status.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'ui/status.go') diff --git a/ui/status.go b/ui/status.go index d1a40c3..7e8687e 100644 --- a/ui/status.go +++ b/ui/status.go @@ -34,7 +34,7 @@ type StatusOption struct { } // to print dropped in red color, etc -func getColorCodeByStatus(status string) string { +func GetColorCodeByStatus(status string) string { switch status { case "watching", "reading": return "\x1b[32m" @@ -46,6 +46,31 @@ func getColorCodeByStatus(status string) string { return "\x1b[31m" case "plan_to_watch", "plan_to_read": return "\x1b[36m" + case "": + return "\x1b[38;5;7m" + default: + return "" + } +} + +func FormatStatus(status string) string { + switch status { + case "watching": + return "Watching" + case "reading": + return "Reading" + case "completed": + return "Completed" + case "on_hold": + return "On Hold" + case "dropped": + return "Dropped" + case "plan_to_watch": + return "Plan to Watch" + case "plan_to_read": + return "Plan to Read" + case "": + return "Not in List" default: return "" } @@ -53,7 +78,7 @@ 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" + return "Set \x1b[35m" + title + "\x1b[0m status to " + GetColorCodeByStatus(status) + FormatStatus(status) + "\x1b[0m" } func AnimeStatusMenu(anime a.Anime) { -- cgit v1.2.3