mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Move jobNameRegex setting into Jenkins settings
This commit is contained in:
commit
2ed3c087b8
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### ⚡️ Added
|
||||||
|
|
||||||
|
* Jenkins now supports coloured balls, [#358](https://github.com/wtfutil/wtf/issues/358) by [@rudolphjacksonm](https://github.com/rudolphjacksonm)
|
||||||
|
|
||||||
## 0.6.0
|
## 0.6.0
|
||||||
|
|
||||||
### ⚡️ Added
|
### ⚡️ Added
|
||||||
|
@ -13,6 +13,7 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
|
|
||||||
apiKey string
|
apiKey string
|
||||||
|
jobNameRegex string
|
||||||
successBallColor string
|
successBallColor string
|
||||||
url string
|
url string
|
||||||
user string
|
user string
|
||||||
@ -26,6 +27,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
|||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
||||||
|
jobNameRegex: localConfig.UString("jobNameRegex", ".*"),
|
||||||
successBallColor: localConfig.UString("successBallColor", "blue"),
|
successBallColor: localConfig.UString("successBallColor", "blue"),
|
||||||
url: localConfig.UString("url"),
|
url: localConfig.UString("url"),
|
||||||
user: localConfig.UString("user"),
|
user: localConfig.UString("user"),
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
"github.com/wtfutil/wtf/wtf"
|
"github.com/wtfutil/wtf/wtf"
|
||||||
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const HelpText = `
|
const HelpText = `
|
||||||
@ -91,6 +92,9 @@ func (widget *Widget) display() {
|
|||||||
func (widget *Widget) contentFrom(view *View) string {
|
func (widget *Widget) contentFrom(view *View) string {
|
||||||
var str string
|
var str string
|
||||||
for idx, job := range view.Jobs {
|
for idx, job := range view.Jobs {
|
||||||
|
var validID = regexp.MustCompile(widget.settings.jobNameRegex)
|
||||||
|
|
||||||
|
if validID.MatchString(job.Name) {
|
||||||
str = str + fmt.Sprintf(
|
str = str + fmt.Sprintf(
|
||||||
`["%d"][""][%s] [%s]%-6s[white]`,
|
`["%d"][""][%s] [%s]%-6s[white]`,
|
||||||
idx,
|
idx,
|
||||||
@ -101,6 +105,7 @@ func (widget *Widget) contentFrom(view *View) string {
|
|||||||
|
|
||||||
str = str + "\n"
|
str = str + "\n"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user