From 1460e1bac2f107e715de55656e4e9c3e7a59cec3 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 15 Apr 2024 10:47:45 -0600 Subject: imworkingon: Color-code statuses --- cmd/generate/src_contribs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cmd/generate/src_contribs.go') diff --git a/cmd/generate/src_contribs.go b/cmd/generate/src_contribs.go index 46683d3..291d47b 100644 --- a/cmd/generate/src_contribs.go +++ b/cmd/generate/src_contribs.go @@ -20,6 +20,7 @@ type Contribution struct { SubmittedAt time.Time `json:"submitted-at"` LastUpdatedAt time.Time `json:"last-updated-at"` Status string `json:"status"` + StatusClass string `json:"-"` } func ReadContribs(filename string) ([]Contribution, error) { @@ -55,6 +56,18 @@ func (c *Contribution) Fill() error { return err } } + switch { + case strings.Contains(c.Status, "open"): + c.StatusClass = "open" + case strings.Contains(c.Status, "merged"): + c.StatusClass = "merged" + case strings.Contains(c.Status, "released") || strings.Contains(c.Status, "deployed"): + c.StatusClass = "released" + case strings.Contains(c.Status, "closed"): + c.StatusClass = "closed" + default: + return fmt.Errorf("unrecognized status string: %q", c.Status) + } return nil } -- cgit v1.2.3-54-g00ecf