mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Move name and configKey values from widget to settings
This commit is contained in:
parent
d174bd1497
commit
b50c762dab
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {}
|
||||
}
|
@ -15,6 +15,11 @@ type Colors struct {
|
||||
Text string
|
||||
}
|
||||
|
||||
type Module struct {
|
||||
ConfigKey string
|
||||
Name string
|
||||
}
|
||||
|
||||
type Position struct {
|
||||
Height int
|
||||
Left int
|
||||
@ -24,6 +29,7 @@ type Position struct {
|
||||
|
||||
type Common struct {
|
||||
Colors
|
||||
Module
|
||||
Position
|
||||
|
||||
Enabled bool
|
||||
@ -31,7 +37,7 @@ type Common struct {
|
||||
Title string
|
||||
}
|
||||
|
||||
func NewCommonSettingsFromYAML(ymlConfig *config.Config) *Common {
|
||||
func NewCommonSettingsFromYAML(name, configKey string, ymlConfig *config.Config) *Common {
|
||||
common := Common{
|
||||
Colors: Colors{
|
||||
Background: ymlConfig.UString("wtf.colors.background", "black"),
|
||||
@ -43,6 +49,12 @@ func NewCommonSettingsFromYAML(ymlConfig *config.Config) *Common {
|
||||
HighlightBack: ymlConfig.UString("wtf.colors.highlight.back"),
|
||||
Text: ymlConfig.UString("wtf.colors.text", "white"),
|
||||
},
|
||||
|
||||
Module: Module{
|
||||
ConfigKey: configKey,
|
||||
Name: name,
|
||||
},
|
||||
|
||||
Position: Position{},
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "logger"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
90
main.go
90
main.go
@ -182,141 +182,141 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
||||
// Always in alphabetical order
|
||||
switch widgetName {
|
||||
case "bamboohr":
|
||||
settings := bamboohr.NewSettingsFromYAML(wtf.Config)
|
||||
settings := bamboohr.NewSettingsFromYAML("BambooHR", wtf.Config)
|
||||
widget = bamboohr.NewWidget(app, settings)
|
||||
case "bargraph":
|
||||
widget = bargraph.NewWidget(app)
|
||||
case "bittrex":
|
||||
settings := bittrex.NewSettingsFromYAML(wtf.Config)
|
||||
settings := bittrex.NewSettingsFromYAML("Bittrex", wtf.Config)
|
||||
widget = bittrex.NewWidget(app, settings)
|
||||
case "blockfolio":
|
||||
settings := blockfolio.NewSettingsFromYAML(wtf.Config)
|
||||
settings := blockfolio.NewSettingsFromYAML("Blockfolio", wtf.Config)
|
||||
widget = blockfolio.NewWidget(app, settings)
|
||||
case "circleci":
|
||||
settings := circleci.NewSettingsFromYAML(wtf.Config)
|
||||
settings := circleci.NewSettingsFromYAML("CircleCI", wtf.Config)
|
||||
widget = circleci.NewWidget(app, settings)
|
||||
case "clocks":
|
||||
settings := clocks.NewSettingsFromYAML(wtf.Config)
|
||||
settings := clocks.NewSettingsFromYAML("Clocks", wtf.Config)
|
||||
widget = clocks.NewWidget(app, settings)
|
||||
case "cmdrunner":
|
||||
settings := cmdrunner.NewSettingsFromYAML(wtf.Config)
|
||||
settings := cmdrunner.NewSettingsFromYAML("CmdRunner", wtf.Config)
|
||||
widget = cmdrunner.NewWidget(app, settings)
|
||||
case "cryptolive":
|
||||
settings := cryptolive.NewSettingsFromYAML(wtf.Config)
|
||||
settings := cryptolive.NewSettingsFromYAML("CryptoLive", wtf.Config)
|
||||
widget = cryptolive.NewWidget(app, settings)
|
||||
case "datadog":
|
||||
settings := datadog.NewSettingsFromYAML(wtf.Config)
|
||||
settings := datadog.NewSettingsFromYAML("DataDog", wtf.Config)
|
||||
widget = datadog.NewWidget(app, settings)
|
||||
case "gcal":
|
||||
settings := gcal.NewSettingsFromYAML(wtf.Config)
|
||||
settings := gcal.NewSettingsFromYAML("Calendar", wtf.Config)
|
||||
widget = gcal.NewWidget(app, settings)
|
||||
case "gerrit":
|
||||
settings := gerrit.NewSettingsFromYAML(wtf.Config)
|
||||
settings := gerrit.NewSettingsFromYAML("Gerrit", wtf.Config)
|
||||
widget = gerrit.NewWidget(app, pages, settings)
|
||||
case "git":
|
||||
settings := git.NewSettingsFromYAML(wtf.Config)
|
||||
settings := git.NewSettingsFromYAML("Git", wtf.Config)
|
||||
widget = git.NewWidget(app, pages, settings)
|
||||
case "github":
|
||||
settings := github.NewSettingsFromYAML(wtf.Config)
|
||||
settings := github.NewSettingsFromYAML("GitHub", wtf.Config)
|
||||
widget = github.NewWidget(app, pages, settings)
|
||||
case "gitlab":
|
||||
settings := gitlab.NewSettingsFromYAML(wtf.Config)
|
||||
settings := gitlab.NewSettingsFromYAML("GitLab", wtf.Config)
|
||||
widget = gitlab.NewWidget(app, pages, settings)
|
||||
case "gitter":
|
||||
settings := gitter.NewSettingsFromYAML(wtf.Config)
|
||||
settings := gitter.NewSettingsFromYAML("Gitter", wtf.Config)
|
||||
widget = gitter.NewWidget(app, pages, settings)
|
||||
case "gspreadsheets":
|
||||
settings := gspreadsheets.NewSettingsFromYAML(wtf.Config)
|
||||
settings := gspreadsheets.NewSettingsFromYAML("Google Spreadsheets", wtf.Config)
|
||||
widget = gspreadsheets.NewWidget(app, settings)
|
||||
case "hackernews":
|
||||
settings := hackernews.NewSettingsFromYAML(wtf.Config)
|
||||
settings := hackernews.NewSettingsFromYAML("HackerNews", wtf.Config)
|
||||
widget = hackernews.NewWidget(app, pages, settings)
|
||||
case "ipapi":
|
||||
settings := ipapi.NewSettingsFromYAML(wtf.Config)
|
||||
settings := ipapi.NewSettingsFromYAML("IPAPI", wtf.Config)
|
||||
widget = ipapi.NewWidget(app, settings)
|
||||
case "ipinfo":
|
||||
settings := ipinfo.NewSettingsFromYAML(wtf.Config)
|
||||
settings := ipinfo.NewSettingsFromYAML("IPInfo", wtf.Config)
|
||||
widget = ipinfo.NewWidget(app, settings)
|
||||
case "jenkins":
|
||||
settings := jenkins.NewSettingsFromYAML(wtf.Config)
|
||||
settings := jenkins.NewSettingsFromYAML("Jenkins", wtf.Config)
|
||||
widget = jenkins.NewWidget(app, pages, settings)
|
||||
case "jira":
|
||||
settings := jira.NewSettingsFromYAML(wtf.Config)
|
||||
settings := jira.NewSettingsFromYAML("Jira", wtf.Config)
|
||||
widget = jira.NewWidget(app, pages, settings)
|
||||
case "logger":
|
||||
settings := logger.NewSettingsFromYAML(wtf.Config)
|
||||
settings := logger.NewSettingsFromYAML("Log", wtf.Config)
|
||||
widget = logger.NewWidget(app, settings)
|
||||
case "mercurial":
|
||||
settings := mercurial.NewSettingsFromYAML(wtf.Config)
|
||||
settings := mercurial.NewSettingsFromYAML("Mercurial", wtf.Config)
|
||||
widget = mercurial.NewWidget(app, pages, settings)
|
||||
case "nbascore":
|
||||
settings := nbascore.NewSettingsFromYAML(wtf.Config)
|
||||
settings := nbascore.NewSettingsFromYAML("NBA Score", wtf.Config)
|
||||
widget = nbascore.NewWidget(app, pages, settings)
|
||||
case "newrelic":
|
||||
settings := newrelic.NewSettingsFromYAML(wtf.Config)
|
||||
settings := newrelic.NewSettingsFromYAML("NewRelic", wtf.Config)
|
||||
widget = newrelic.NewWidget(app, settings)
|
||||
case "opsgenie":
|
||||
settings := opsgenie.NewSettingsFromYAML(wtf.Config)
|
||||
settings := opsgenie.NewSettingsFromYAML("OpsGenie", wtf.Config)
|
||||
widget = opsgenie.NewWidget(app, settings)
|
||||
case "pagerduty":
|
||||
settings := pagerduty.NewSettingsFromYAML(wtf.Config)
|
||||
settings := pagerduty.NewSettingsFromYAML("PagerDuty", wtf.Config)
|
||||
widget = pagerduty.NewWidget(app, settings)
|
||||
case "power":
|
||||
settings := power.NewSettingsFromYAML(wtf.Config)
|
||||
settings := power.NewSettingsFromYAML("Power", wtf.Config)
|
||||
widget = power.NewWidget(app, settings)
|
||||
case "prettyweather":
|
||||
settings := prettyweather.NewSettingsFromYAML(wtf.Config)
|
||||
settings := prettyweather.NewSettingsFromYAML("Pretty Weather", wtf.Config)
|
||||
widget = prettyweather.NewWidget(app, settings)
|
||||
case "resourceusage":
|
||||
settings := resourceusage.NewSettingsFromYAML(wtf.Config)
|
||||
settings := resourceusage.NewSettingsFromYAML("Resource Usage", wtf.Config)
|
||||
widget = resourceusage.NewWidget(app, settings)
|
||||
case "rollbar":
|
||||
settings := rollbar.NewSettingsFromYAML(wtf.Config)
|
||||
settings := rollbar.NewSettingsFromYAML("Rollbar", wtf.Config)
|
||||
widget = rollbar.NewWidget(app, pages, settings)
|
||||
case "security":
|
||||
settings := security.NewSettingsFromYAML(wtf.Config)
|
||||
settings := security.NewSettingsFromYAML("Security", wtf.Config)
|
||||
widget = security.NewWidget(app, settings)
|
||||
case "spotify":
|
||||
settings := spotify.NewSettingsFromYAML(wtf.Config)
|
||||
settings := spotify.NewSettingsFromYAML("Spotify", wtf.Config)
|
||||
widget = spotify.NewWidget(app, pages, settings)
|
||||
case "spotifyweb":
|
||||
settings := spotifyweb.NewSettingsFromYAML(wtf.Config)
|
||||
settings := spotifyweb.NewSettingsFromYAML("Spotify Web", wtf.Config)
|
||||
widget = spotifyweb.NewWidget(app, pages, settings)
|
||||
case "status":
|
||||
settings := status.NewSettingsFromYAML(wtf.Config)
|
||||
settings := status.NewSettingsFromYAML("Status", wtf.Config)
|
||||
widget = status.NewWidget(app, settings)
|
||||
case "system":
|
||||
settings := system.NewSettingsFromYAML(wtf.Config)
|
||||
settings := system.NewSettingsFromYAML("System", wtf.Config)
|
||||
widget = system.NewWidget(app, date, version, settings)
|
||||
case "textfile":
|
||||
settings := textfile.NewSettingsFromYAML(wtf.Config)
|
||||
settings := textfile.NewSettingsFromYAML("Textfile", wtf.Config)
|
||||
widget = textfile.NewWidget(app, pages, settings)
|
||||
case "todo":
|
||||
settings := todo.NewSettingsFromYAML(wtf.Config)
|
||||
settings := todo.NewSettingsFromYAML("Todo", wtf.Config)
|
||||
widget = todo.NewWidget(app, pages, settings)
|
||||
case "todoist":
|
||||
settings := todoist.NewSettingsFromYAML(wtf.Config)
|
||||
settings := todoist.NewSettingsFromYAML("Todoist", wtf.Config)
|
||||
widget = todoist.NewWidget(app, pages, settings)
|
||||
case "travisci":
|
||||
settings := travisci.NewSettingsFromYAML(wtf.Config)
|
||||
settings := travisci.NewSettingsFromYAML("TravisCI", wtf.Config)
|
||||
widget = travisci.NewWidget(app, pages, settings)
|
||||
case "trello":
|
||||
settings := trello.NewSettingsFromYAML(wtf.Config)
|
||||
settings := trello.NewSettingsFromYAML("Trello", wtf.Config)
|
||||
widget = trello.NewWidget(app, settings)
|
||||
case "twitter":
|
||||
settings := twitter.NewSettingsFromYAML(wtf.Config)
|
||||
settings := twitter.NewSettingsFromYAML("Twitter", wtf.Config)
|
||||
widget = twitter.NewWidget(app, pages, settings)
|
||||
case "victorops":
|
||||
settings := victorops.NewSettingsFromYAML(wtf.Config)
|
||||
settings := victorops.NewSettingsFromYAML("VictorOps - OnCall", wtf.Config)
|
||||
widget = victorops.NewWidget(app, settings)
|
||||
case "weather":
|
||||
settings := weather.NewSettingsFromYAML(wtf.Config)
|
||||
settings := weather.NewSettingsFromYAML("Weather", wtf.Config)
|
||||
widget = weather.NewWidget(app, pages, settings)
|
||||
case "zendesk":
|
||||
settings := zendesk.NewSettingsFromYAML(wtf.Config)
|
||||
settings := zendesk.NewSettingsFromYAML("Zendesk", wtf.Config)
|
||||
widget = zendesk.NewWidget(app, settings)
|
||||
default:
|
||||
settings := unknown.NewSettingsFromYAML(wtf.Config)
|
||||
settings := unknown.NewSettingsFromYAML(widgetName, wtf.Config)
|
||||
widget = unknown.NewWidget(app, widgetName, settings)
|
||||
}
|
||||
|
||||
|
@ -7,20 +7,23 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
Common *cfg.Common
|
||||
const configKey = "bamboohr"
|
||||
|
||||
APIKey string
|
||||
Subdomain string
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
apiKey string
|
||||
subdomain string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.bamboohr")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
APIKey: localConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
|
||||
Subdomain: localConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
|
||||
subdomain: localConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "BambooHR", "bamboohr", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
@ -30,8 +30,8 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
client := NewClient(
|
||||
APIURI,
|
||||
widget.settings.APIKey,
|
||||
widget.settings.Subdomain,
|
||||
widget.settings.apiKey,
|
||||
widget.settings.subdomain,
|
||||
)
|
||||
|
||||
todayItems := client.Away(
|
||||
|
@ -7,17 +7,20 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "circleci"
|
||||
|
||||
type Settings struct {
|
||||
Common *cfg.Common
|
||||
common *cfg.Common
|
||||
|
||||
apiKey string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.circleci")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_CIRCLE_API_KEY")),
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "CircleCI", "circleci", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
Client: NewClient(settings.apiKey),
|
||||
|
||||
settings: settings,
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const configKey = "clocks"
|
||||
|
||||
type colors struct {
|
||||
rows struct {
|
||||
even string
|
||||
@ -23,11 +25,11 @@ type Settings struct {
|
||||
sort string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.clocks")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
dateFormat: localConfig.UString("dateFormat", wtf.SimpleDateFormat),
|
||||
timeFormat: localConfig.UString("timeFormat", wtf.SimpleTimeFormat),
|
||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "World Clocks", "clocks", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
dateFormat: settings.dateFormat,
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const configKey = "cmdrunner"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -13,11 +15,11 @@ type Settings struct {
|
||||
cmd string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.cmdrunner")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
args: wtf.ToStrs(localConfig.UList("args")),
|
||||
cmd: localConfig.UString("cmd"),
|
||||
|
@ -20,7 +20,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "CmdRunner", "cmdrunner", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
args: settings.args,
|
||||
cmd: settings.cmd,
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "bittrex"
|
||||
|
||||
type colors struct {
|
||||
base struct {
|
||||
name string
|
||||
@ -24,11 +26,11 @@ type Settings struct {
|
||||
summary map[string]interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.bittrex")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
settings.colors.base.name = localConfig.UString("colors.base.name")
|
||||
|
@ -27,7 +27,7 @@ type Widget struct {
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Bittrex", "bittrex", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
summaryList: summaryList{},
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "blockfolio"
|
||||
|
||||
type colors struct {
|
||||
name string
|
||||
grows string
|
||||
@ -19,11 +21,11 @@ type Settings struct {
|
||||
displayHoldings bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.blockfolio")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
deviceToken: localConfig.UString("device_token"),
|
||||
displayHoldings: localConfig.UBool("displayHoldings", true),
|
||||
|
@ -20,7 +20,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Blockfolio", "blockfolio", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
device_token: settings.deviceToken,
|
||||
settings: settings,
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "price"
|
||||
|
||||
type colors struct {
|
||||
from struct {
|
||||
name string
|
||||
@ -34,14 +36,14 @@ type Settings struct {
|
||||
top map[string]interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.cryptolive")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
currencies, _ := localConfig.Map("currencies")
|
||||
top, _ := localConfig.Map("top")
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
currencies: currencies,
|
||||
top: top,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive/toplist"
|
||||
)
|
||||
|
||||
const configKey = "cryptolive"
|
||||
|
||||
type colors struct {
|
||||
from struct {
|
||||
name string
|
||||
@ -32,6 +34,7 @@ type colors struct {
|
||||
type Settings struct {
|
||||
colors
|
||||
common *cfg.Common
|
||||
|
||||
currencies map[string]interface{}
|
||||
top map[string]interface{}
|
||||
|
||||
@ -39,19 +42,20 @@ type Settings struct {
|
||||
toplistSettings *toplist.Settings
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.cryptolive")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
currencies, _ := localConfig.Map("currencies")
|
||||
top, _ := localConfig.Map("top")
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
currencies: currencies,
|
||||
top: top,
|
||||
|
||||
priceSettings: price.NewSettingsFromYAML(ymlConfig),
|
||||
toplistSettings: toplist.NewSettingsFromYAML(ymlConfig),
|
||||
priceSettings: price.NewSettingsFromYAML(name, ymlConfig),
|
||||
toplistSettings: toplist.NewSettingsFromYAML(name, ymlConfig),
|
||||
}
|
||||
|
||||
settings.colors.from.name = localConfig.UString("colors.from.name")
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "toplist"
|
||||
|
||||
type colors struct {
|
||||
from struct {
|
||||
name string
|
||||
@ -34,14 +36,14 @@ type Settings struct {
|
||||
top map[string]interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.cryptolive")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
currencies, _ := localConfig.Map("currencies")
|
||||
top, _ := localConfig.Map("top")
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
currencies: currencies,
|
||||
top: top,
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ type Widget struct {
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "CryptoLive", "cryptolive", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
priceWidget: price.NewWidget(settings.priceSettings),
|
||||
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "datadog"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,12 @@ type Settings struct {
|
||||
tags []interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.datadog")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_DATADOG_API_KEY")),
|
||||
applicationKey: localConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),
|
||||
tags: localConfig.UList("monitors.tags"),
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Datadog", "datadog", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "gcal"
|
||||
|
||||
type colors struct {
|
||||
day string
|
||||
description string
|
||||
@ -30,11 +32,11 @@ type Settings struct {
|
||||
withLocation bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.gcal")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
conflictIcon: localConfig.UString("conflictIcon", "🚨"),
|
||||
currentIcon: localConfig.UString("currentIcon", "🔸"),
|
||||
|
@ -20,7 +20,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Calendar", "gcal", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
app: app,
|
||||
ch: make(chan struct{}),
|
||||
|
@ -14,6 +14,8 @@ type colors struct {
|
||||
}
|
||||
}
|
||||
|
||||
const configKey = "gerrit"
|
||||
|
||||
type Settings struct {
|
||||
colors
|
||||
common *cfg.Common
|
||||
@ -25,11 +27,11 @@ type Settings struct {
|
||||
verifyServerCertificate bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.gerrit")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
domain: localConfig.UString("domain", ""),
|
||||
password: localConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),
|
||||
|
@ -49,7 +49,7 @@ var (
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Gerrit", "gerrit", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Idx: 0,
|
||||
settings: settings,
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "git"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -14,11 +16,11 @@ type Settings struct {
|
||||
repositories []interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.git")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
commitCount: localConfig.UInt("commitCount", 10),
|
||||
commitFormat: localConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),
|
||||
|
@ -43,7 +43,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget("git", "repository", "repositories"),
|
||||
TextWidget: wtf.NewTextWidget(app, "Git", "git", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
app: app,
|
||||
pages: pages,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "github"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -18,11 +20,11 @@ type Settings struct {
|
||||
username string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.github")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_GITHUB_TOKEN")),
|
||||
baseURL: localConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),
|
||||
|
@ -32,7 +32,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "GitHub", "github", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Idx: 0,
|
||||
settings: settings,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "gitlab"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -16,11 +18,11 @@ type Settings struct {
|
||||
username string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.gitlab")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
|
||||
domain: localConfig.UString("domain"),
|
||||
|
@ -39,7 +39,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Gitlab", "gitlab", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Idx: 0,
|
||||
gitlab: gitlab,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "gitter"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
roomURI string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.gitter")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiToken: localConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
|
||||
numberOfMessages: localConfig.UInt("numberOfMessages", 10),
|
||||
|
@ -32,7 +32,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Gitter", "gitter", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "gspreadsheets"
|
||||
|
||||
type colors struct {
|
||||
values string
|
||||
}
|
||||
@ -19,11 +21,11 @@ type Settings struct {
|
||||
sheetID string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.gspreadsheets")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
cellNames: localConfig.UList("cells.names"),
|
||||
secretFile: localConfig.UString("secretFile"),
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Google Spreadsheets", "gspreadsheets", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "hackernews"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -12,11 +14,11 @@ type Settings struct {
|
||||
storyType string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.hackernews")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
numberOfStories: localConfig.UInt("numberOfStories", 10),
|
||||
storyType: localConfig.UString("storyType", "top"),
|
||||
|
@ -38,7 +38,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Hacker News", "hackernews", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "ipapi"
|
||||
|
||||
type colors struct {
|
||||
name string
|
||||
value string
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.ipapi")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
settings.colors.name = localConfig.UString("colors.name", "red")
|
||||
|
@ -38,7 +38,7 @@ type ipinfo struct {
|
||||
// NewWidget constructor
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "IPInfo", "ipapi", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "ipinfo"
|
||||
|
||||
type colors struct {
|
||||
name string
|
||||
value string
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.ipinfo")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
settings.colors.name = localConfig.UString("colors.name", "red")
|
||||
|
@ -31,7 +31,7 @@ type ipinfo struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "IPInfo", "ipinfo", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "jenkins"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -17,11 +19,11 @@ type Settings struct {
|
||||
verifyServerCertificate bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.jenkins")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
||||
successBallColor: localConfig.UString("successBallColor", "blue"),
|
||||
|
@ -35,7 +35,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Jenkins", "jenkins", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "jira"
|
||||
|
||||
type colors struct {
|
||||
rows struct {
|
||||
even string
|
||||
@ -27,11 +29,11 @@ type Settings struct {
|
||||
verifyServerCertificate bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.jira")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JIRA_API_KEY")),
|
||||
domain: localConfig.UString("domain"),
|
||||
|
@ -34,7 +34,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Jira", "jira", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "mercurial"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -13,11 +15,11 @@ type Settings struct {
|
||||
repositories []interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.mercurial")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
commitCount: localConfig.UInt("commitCount", 10),
|
||||
commitFormat: localConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
|
||||
|
@ -37,8 +37,8 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget("mercurial", "repository", "repositories"),
|
||||
TextWidget: wtf.NewTextWidget(app, "Mercurial", "mercurial", true),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "repository", "repositories"),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
app: app,
|
||||
pages: pages,
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "nbascore"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -33,7 +33,7 @@ var offset = 0
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "NBA Score", "nbascore", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "newrelic"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
deployCount int
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.newrelic")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
|
||||
applicationID: localConfig.UInt("applicationID"),
|
||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "New Relic", "newrelic", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "opsgenie"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -16,11 +18,11 @@ type Settings struct {
|
||||
scheduleIdentifierType string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.opsgenie")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_OPS_GENIE_API_KEY")),
|
||||
displayEmpty: localConfig.UBool("displayEmpty", true),
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "OpsGenie", "opsgenie", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "pagerduty"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -16,11 +18,11 @@ type Settings struct {
|
||||
showSchedules bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.pagerduty")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_PAGERDUTY_API_KEY")),
|
||||
escalationFilter: localConfig.UList("escalationFilter"),
|
||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "PagerDuty", "pagerduty", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,15 +5,17 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "power"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
filePath string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Power", "power", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
Battery: NewBattery(),
|
||||
settings: settings,
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "resourceusage"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -24,7 +24,7 @@ type Widget struct {
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: wtf.NewBarGraph(app, "Resource Usage", "resourceusage", false),
|
||||
BarGraph: wtf.NewBarGraph(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "rollbar"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -16,11 +18,11 @@ type Settings struct {
|
||||
projectOwner string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.rollbar")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
accessToken: localConfig.UString("accessToken"),
|
||||
activeOnly: localConfig.UBool("activeOnly", false),
|
||||
|
@ -35,7 +35,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Rollbar", "rollbar", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "security"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Security", "security", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "spotify"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -30,7 +30,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
spotifyClient := spotigopher.NewClient()
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Spotify", "spotify", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Info: spotigopher.Info{},
|
||||
SpotifyClient: spotifyClient,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "spotifyweb"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
secretKey string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.spotifyweb")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
callbackPort: localConfig.UString("callbackPort", "8080"),
|
||||
clientID: localConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),
|
||||
|
@ -93,7 +93,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "SpotifyWeb", "spotifyweb", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Info: Info{},
|
||||
client: client,
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "status"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -14,7 +14,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Status", "status", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
CurrentIcon: 0,
|
||||
settings: settings,
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "system"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "System", "system", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
Date: date,
|
||||
settings: settings,
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "textfile"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -13,11 +15,11 @@ type Settings struct {
|
||||
formatStyle string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.textfile")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
filePaths: localConfig.UList("filePaths"),
|
||||
format: localConfig.UBool("format", false),
|
||||
|
@ -41,8 +41,8 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget("textfile", "filePath", "filePaths"),
|
||||
TextWidget: wtf.NewTextWidget(app, "TextFile", "textfile", true),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "filePath", "filePaths"),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -5,17 +5,19 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "todo"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
filePath string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.todo")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
filePath: localConfig.UString("filename"),
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Todo", "todo", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "todoist"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -14,11 +16,11 @@ type Settings struct {
|
||||
projects []interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.todoist")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TODOIST_TOKEN")),
|
||||
projects: localConfig.UList("projects"),
|
||||
|
@ -37,7 +37,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Todoist", "todoist", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,18 +7,20 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "travisci"
|
||||
|
||||
type Settings struct {
|
||||
Common *cfg.Common
|
||||
common *cfg.Common
|
||||
|
||||
apiKey string
|
||||
pro bool
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.travisci")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TRAVIS_API_TOKEN")),
|
||||
pro: localConfig.UBool("pro", false),
|
||||
|
@ -34,7 +34,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "TravisCI", "travisci", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "trello"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -17,11 +19,11 @@ type Settings struct {
|
||||
username string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.trello")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
accessToken: localConfig.UString("accessToken", os.Getenv("WTF_TRELLO_ACCESS_TOKEN")),
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TRELLO_APP_KEY")),
|
||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Trello", "trello", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "twitter"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
screenNames []interface{}
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.twitter")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
bearerToken: localConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
|
||||
count: localConfig.UInt("count", 5),
|
||||
|
@ -36,8 +36,8 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget("twitter", "screenName", "screenNames"),
|
||||
TextWidget: wtf.NewTextWidget(app, "Twitter", "twitter", true),
|
||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "screenName", "screenNames"),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
idx: 0,
|
||||
settings: settings,
|
||||
|
@ -5,13 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "unkown"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "victorops"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -15,11 +17,11 @@ type Settings struct {
|
||||
team string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.victorops")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiID: localConfig.UString("apiID", os.Getenv("WTF_VICTOROPS_API_ID")),
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_VICTOROPS_API_KEY")),
|
||||
|
@ -27,7 +27,7 @@ type Widget struct {
|
||||
// NewWidget creates a new widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "VictorOps - OnCall", "victorops", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
}
|
||||
|
||||
widget.View.SetScrollable(true)
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "prettyweather"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -14,11 +16,11 @@ type Settings struct {
|
||||
language string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.prettyweather")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
city: localConfig.UString("city", "Barcelona"),
|
||||
language: localConfig.UString("language", "en"),
|
||||
|
@ -18,7 +18,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Pretty Weather", "prettyweather", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "weather"
|
||||
|
||||
type colors struct {
|
||||
current string
|
||||
}
|
||||
@ -21,11 +23,11 @@ type Settings struct {
|
||||
tempUnit string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.weather")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_OWM_API_KEY")),
|
||||
cityIDs: localConfig.UList("cityids"),
|
||||
|
@ -33,7 +33,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Weather", "weather", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
Idx: 0,
|
||||
settings: settings,
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const configKey = "zendesk"
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
@ -16,11 +18,11 @@ type Settings struct {
|
||||
username string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.zendesk")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
apiKey: localConfig.UString("apiKey", os.Getenv("ZENDESK_API")),
|
||||
status: localConfig.UString("status"),
|
||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Zendesk", "zendesk", true),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user