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:
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user