aboutsummaryrefslogtreecommitdiff
path: root/ui/status.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 20:42:30 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 20:42:30 +0530
commit551b158d207d99d439cad39b512a21a6e8bd0c54 (patch)
treed85adcc28565104f9a543201ae72e7a871f9df17 /ui/status.go
parenta3a7b41179d8abe9edc705db6b14063e95c459fa (diff)
added --query option to status command and fixed bug while setting manga status (it calls SetAnimeStatus instead)
Diffstat (limited to 'ui/status.go')
-rw-r--r--ui/status.go29
1 files changed, 27 insertions, 2 deletions
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) {