summaryrefslogtreecommitdiff
path: root/cmd/generate/src_contribs.go
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-04-15 10:47:45 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-04-15 10:47:45 -0600
commit1460e1bac2f107e715de55656e4e9c3e7a59cec3 (patch)
treebe94fb7da329ce0e66bb774206e9d0a481cd06c0 /cmd/generate/src_contribs.go
parenta120510c04424c3fdebfc0c24f0ae9d53410e62d (diff)
imworkingon: Color-code statuses
Diffstat (limited to 'cmd/generate/src_contribs.go')
-rw-r--r--cmd/generate/src_contribs.go13
1 files changed, 13 insertions, 0 deletions
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
}