1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Properly scope Config to the wtf package and remove it as a dependency from everywhere else

This commit is contained in:
Chris Cummer
2018-06-16 14:59:22 -07:00
parent abedee0ce0
commit 66b69471d0
42 changed files with 126 additions and 251 deletions

View File

@@ -1,10 +1,10 @@
package circleci
type Build struct {
AuthorEmail string `json:"author_email"`
AuthorName string `json:"author_name"`
Branch string `json:"branch"`
BuildNum int `json:"build_num"`
Reponame string `json:"reponame"`
Status string `json:"status"`
AuthorEmail string `json:"author_email"`
AuthorName string `json:"author_name"`
Branch string `json:"branch"`
BuildNum int `json:"build_num"`
Reponame string `json:"reponame"`
Status string `json:"status"`
}

View File

@@ -2,13 +2,9 @@ package circleci
import (
"fmt"
"github.com/olebedev/config"
"github.com/senorprogrammer/wtf/wtf"
)
// Config is a pointer to the global config object
var Config *config.Config
type Widget struct {
wtf.TextWidget
}
@@ -65,19 +61,15 @@ func (widget *Widget) contentFrom(builds []*Build) string {
return str
}
func buildColor(b *Build) string {
var color string
switch b.Status {
func buildColor(build *Build) string {
switch build.Status {
case "failed":
color = "red"
return "red"
case "running":
color = "yellow"
return "yellow"
case "success":
color = "green"
return "green"
default:
color = "white"
return "white"
}
return color
}