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