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

Constantize the defaultFocus value for each module

This commit is contained in:
Chris Cummer 2019-09-18 20:34:53 -07:00
parent d6208b4730
commit bf877f5fa7
120 changed files with 421 additions and 255 deletions

View File

@ -57,7 +57,7 @@ type Common struct {
focusChar int `help:"Define one of the number keys as a short cut key to access the widget." optional:"true"`
}
func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
func NewCommonSettingsFromModule(name, defaultTitle string, defaultFocusable bool, moduleConfig *config.Config, globalSettings *config.Config) *Common {
colorsConfig, _ := globalSettings.Get("wtf.colors")
sigilsPath := "wtf.sigils"
@ -84,7 +84,7 @@ func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config
Bordered: moduleConfig.UBool("border", true),
Enabled: moduleConfig.UBool("enabled", false),
Focusable: moduleConfig.UBool("focusable", false),
Focusable: moduleConfig.UBool("focusable", defaultFocusable),
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
Title: moduleConfig.UString("title", defaultTitle),
Config: moduleConfig,

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "azuredevops"
const (
defaultFocus = false
defaultTitle = "azuredevops"
)
// Settings defines the configuration options for this module
type Settings struct {
@ -23,7 +26,7 @@ type Settings struct {
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocus, ymlConfig, globalConfig),
labelColor: ymlConfig.UString("labelColor", "white"),
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE DEVOPS_API_TOKEN")),

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "BambooHR"
const (
defaultFocusable = false
defaultTitle = "BambooHR"
)
type Settings struct {
common *cfg.Common
@ -18,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_BAMBOO_HR_TOKEN"))),
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),

View File

@ -10,7 +10,7 @@ import (
"github.com/wtfutil/wtf/wtf"
)
const APIURI = "https://api.bamboohr.com/api/gateway.php"
const apiURI = "https://api.bamboohr.com/api/gateway.php"
type Widget struct {
view.TextWidget
@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}
@ -33,7 +33,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
func (widget *Widget) Refresh() {
client := NewClient(
APIURI,
apiURI,
widget.settings.apiKey,
widget.settings.subdomain,
)

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Bargraph"
const (
defaultFocusable = false
defaultTitle = "Bargraph"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -12,8 +12,10 @@ import (
"github.com/wtfutil/wtf/view"
)
var started = false
var ok = true
var (
ok = true
started = false
)
// Widget define wtf widget to register widget later
type Widget struct {
@ -25,7 +27,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
BarGraph: view.NewBarGraph(app, "Sample Bar Graph", settings.common, false),
BarGraph: view.NewBarGraph(app, "Sample Bar Graph", settings.common),
app: app,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "CircleCI"
const (
defaultFocusable = false
defaultTitle = "CircleCI"
)
type Settings struct {
common *cfg.Common
@ -18,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_CIRCLE_API_KEY"))),
}

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
Client: NewClient(settings.apiKey),
settings: settings,

View File

@ -6,7 +6,10 @@ import (
"github.com/wtfutil/wtf/utils"
)
const defaultTitle = "Clocks"
const (
defaultFocusable = false
defaultTitle = "Clocks"
)
type colors struct {
rows struct {
@ -26,9 +29,8 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
dateFormat: ymlConfig.UString("dateFormat", utils.SimpleDateFormat),
timeFormat: ymlConfig.UString("timeFormat", utils.SimpleTimeFormat),

View File

@ -20,7 +20,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
settings: settings,

View File

@ -6,7 +6,10 @@ import (
"github.com/wtfutil/wtf/utils"
)
const defaultTitle = "CmdRunner"
const (
defaultFocusable = false
defaultTitle = "CmdRunner"
)
type Settings struct {
common *cfg.Common
@ -18,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, moduleConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
args: utils.ToStrs(moduleConfig.UList("args")),
cmd: moduleConfig.UString("cmd"),

View File

@ -21,7 +21,7 @@ type Widget struct {
// NewWidget creates a new instance of the widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
args: settings.args,
cmd: settings.cmd,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Bittrex"
const (
defaultFocusable = false
defaultTitle = "Bittrex"
)
type colors struct {
base struct {
@ -37,7 +40,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
settings.colors.base.name = ymlConfig.UString("colors.base.name")

View File

@ -11,10 +11,14 @@ import (
"github.com/wtfutil/wtf/view"
)
var ok = true
var errorText = ""
const (
baseURL = "https://bittrex.com/api/v1.1/public/getmarketsummary"
)
const baseURL = "https://bittrex.com/api/v1.1/public/getmarketsummary"
var (
errorText = ""
ok = true
)
// Widget define wtf widget to register widget later
type Widget struct {
@ -27,7 +31,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
summaryList: summaryList{},

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Blockfolio"
const (
defaultFocusable = false
defaultTitle = "Blockfolio"
)
type colors struct {
name string
@ -24,7 +27,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
deviceToken: ymlConfig.UString("device_token"),
displayHoldings: ymlConfig.UBool("displayHoldings", true),

View File

@ -20,7 +20,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
device_token: settings.deviceToken,
settings: settings,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "CryptoLive"
const (
defaultFocusable = false
defaultTitle = "CryptoLive"
)
type colors struct {
from struct {
@ -43,7 +46,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
settings.colors.from.name = ymlConfig.UString("colors.from.name")

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive/toplist"
)
const defaultTitle = "CryptolLive"
const (
defaultFocusable = false
defaultTitle = "CryptolLive"
)
type colors struct {
from struct {
@ -43,12 +46,11 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
currencies, _ := ymlConfig.Map("currencies")
top, _ := ymlConfig.Map("top")
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
currencies: currencies,
top: top,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "CryptoLive"
const (
defaultFocusable = false
defaultTitle = "CryptoLive"
)
type colors struct {
from struct {
@ -44,7 +47,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
settings.colors.from.name = ymlConfig.UString("colors.from.name")

View File

@ -22,7 +22,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
priceWidget: price.NewWidget(settings.priceSettings),
toplistWidget: toplist.NewWidget(settings.toplistSettings),

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "DataDog"
const (
defaultFocusable = true
defaultTitle = "DataDog"
)
type Settings struct {
common *cfg.Common
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_DATADOG_API_KEY"))),
applicationKey: ymlConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -6,7 +6,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "dev.to | News Feed"
const (
defaultFocusable = true
defaultTitle = "dev.to | News Feed"
)
// Settings defines the configuration options for this module
type Settings struct {
@ -21,7 +24,7 @@ type Settings struct {
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
func NewSettingsFromYAML(name string, yamlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, yamlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, yamlConfig, globalConfig),
numberOfArticles: yamlConfig.UInt("numberOfArticles", 10),
contentTag: yamlConfig.UString("contentTag", ""),
contentUsername: yamlConfig.UString("contentUsername", ""),

View File

@ -22,7 +22,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := &Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Clocks"
const (
defaultFocusable = false
defaultTitle = "Clocks"
)
// Settings struct to define settings got digital clock
type Settings struct {
@ -21,7 +24,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
color: ymlConfig.UString("color"),
font: ymlConfig.UString("font"),
hourFormat: ymlConfig.UString("hourFormat"),

View File

@ -17,7 +17,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
settings: settings,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "docker"
const (
defaultFocusable = false
defaultTitle = "docker"
)
// Settings defines the configuration options for this module
type Settings struct {
@ -16,7 +19,7 @@ type Settings struct {
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
labelColor: ymlConfig.UString("labelColor", "white"),
}

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,8 @@ import (
)
const (
defaultTitle = "Feed Reader"
defaultFocusable = true
defaultTitle = "Feed Reader"
)
// Settings defines the configuration properties for this module
@ -21,7 +22,7 @@ type Settings struct {
// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := &Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
feeds: utils.ToStrs(ymlConfig.UList("feeds")),
feedLimit: ymlConfig.UInt("feedLimit", -1),

View File

@ -36,7 +36,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := &Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
parser: gofeed.NewParser(),
settings: settings,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Calendar"
const (
defaultFocusable = true
defaultTitle = "Calendar"
)
type colors struct {
day string
@ -37,9 +40,8 @@ type Settings struct {
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
currentIcon: ymlConfig.UString("currentIcon", "🔸"),

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
settings: settings,

View File

@ -7,6 +7,11 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const (
defaultFocusable = true
defaultTitle = "Gerrit"
)
type colors struct {
rows struct {
even string `help:"Define the foreground color for even-numbered rows." values:"Any X11 color name." optional:"true"`
@ -14,8 +19,6 @@ type colors struct {
}
}
const defaultTitle = "Gerrit"
type Settings struct {
colors
common *cfg.Common
@ -28,9 +31,8 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
domain: ymlConfig.UString("domain", ""),
password: ymlConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),

View File

@ -33,7 +33,7 @@ var (
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
Idx: 0,

View File

@ -6,7 +6,10 @@ import (
"github.com/wtfutil/wtf/utils"
)
const defaultTitle = "Git"
const (
defaultFocusable = true
defaultTitle = "Git"
)
type Settings struct {
common *cfg.Common
@ -18,9 +21,8 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
commitCount: ymlConfig.UInt("commitCount", 10),
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),

View File

@ -11,9 +11,11 @@ import (
"github.com/wtfutil/wtf/view"
)
const offscreen = -1000
const modalWidth = 80
const modalHeight = 7
const (
modalHeight = 7
modalWidth = 80
offscreen = -1000
)
type Widget struct {
view.KeyboardWidget
@ -31,7 +33,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
pages: pages,

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "GitHub"
const (
defaultFocusable = true
defaultTitle = "GitHub"
)
// Settings defines the configuration properties for this module
type Settings struct {
@ -30,9 +33,8 @@ type customQuery struct {
// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITHUB_TOKEN"))),
baseURL: ymlConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),

View File

@ -28,7 +28,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "GitLab"
const (
defaultFocusable = true
defaultTitle = "GitLab"
)
// Settings defines the configuration properties for this module
type Settings struct {
@ -22,7 +25,7 @@ type Settings struct {
// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITLAB_TOKEN"))),
domain: ymlConfig.UString("domain"),

View File

@ -28,7 +28,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
gitlab: gitlab,
settings: settings,

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Gitter"
const (
defaultFocusable = true
defaultTitle = "Gitter"
)
type Settings struct {
common *cfg.Common
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
numberOfMessages: ymlConfig.UInt("numberOfMessages", 10),

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Google Analytics"
const (
defaultFocusable = false
defaultTitle = "Google Analytics"
)
type Settings struct {
common *cfg.Common
@ -19,7 +22,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
months: ymlConfig.UInt("months"),
secretFile: ymlConfig.UString("secretFile"),

View File

@ -13,7 +13,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Google Spreadsheets"
const (
defaultFocusable = false
defaultTitle = "Google Spreadsheets"
)
type colors struct {
values string
@ -24,7 +27,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
cellNames: ymlConfig.UList("cells.names"),
secretFile: ymlConfig.UString("secretFile"),

View File

@ -19,7 +19,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "HackerNews"
const (
defaultFocusable = true
defaultTitle = "HackerNews"
)
type Settings struct {
common *cfg.Common
@ -17,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
numberOfStories: ymlConfig.UInt("numberOfStories", 10),
storyType: ymlConfig.UString("storyType", "top"),

View File

@ -22,7 +22,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := &Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -10,6 +10,7 @@ import (
)
const (
defaultFocusable = false
defaultTitle = "HIBP"
minRefreshInterval = 21600 // Six hours
)
@ -32,7 +33,7 @@ type Settings struct {
// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := &Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_HIBP_TOKEN"))),
accounts: utils.ToStrs(ymlConfig.UList("accounts")),

View File

@ -19,7 +19,7 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := &Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "IP API"
const (
defaultFocusable = false
defaultTitle = "IP API"
)
type colors struct {
name string
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
settings.colors.name = ymlConfig.UString("colors.name", "red")

View File

@ -38,7 +38,7 @@ type ipinfo struct {
// NewWidget constructor
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "IPInfo"
const (
defaultFocusable = false
defaultTitle = "IPInfo"
)
type colors struct {
name string
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
settings.colors.name = ymlConfig.UString("colors.name", "red")

View File

@ -31,7 +31,7 @@ type ipinfo struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Jenkins"
const (
defaultFocusable = true
defaultTitle = "Jenkins"
)
type Settings struct {
common *cfg.Common
@ -23,7 +26,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JENKINS_API_KEY"))),
jobNameRegex: ymlConfig.UString("jobNameRegex", ".*"),

View File

@ -20,7 +20,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Jira"
const (
defaultFocusable = true
defaultTitle = "Jira"
)
type colors struct {
rows struct {
@ -32,7 +35,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JIRA_API_KEY"))),
domain: ymlConfig.UString("domain"),

View File

@ -19,7 +19,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -6,7 +6,10 @@ import (
"github.com/wtfutil/wtf/utils"
)
const defaultTitle = "Kubernetes"
const (
defaultFocusable = false
defaultTitle = "Kubernetes"
)
type Settings struct {
common *cfg.Common
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, moduleConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
objects: utils.ToStrs(moduleConfig.UList("objects")),
title: moduleConfig.UString("title"),

View File

@ -24,7 +24,7 @@ type Widget struct {
// NewWidget creates a new instance of the widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
objects: settings.objects,
title: settings.title,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Logger"
const (
defaultFocusable = true
defaultTitle = "Logger"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -10,7 +10,9 @@ import (
"github.com/wtfutil/wtf/view"
)
const maxBufferSize int64 = 1024
const (
maxBufferSize int64 = 1024
)
type Widget struct {
view.TextWidget
@ -22,7 +24,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
filePath: log.LogFilePath(),

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Mercurial"
const (
defaultFocusable = true
defaultTitle = "Mercurial"
)
type Settings struct {
common *cfg.Common
@ -18,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
commitCount: ymlConfig.UInt("commitCount", 10),
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),

View File

@ -7,9 +7,11 @@ import (
"github.com/wtfutil/wtf/view"
)
const offscreen = -1000
const modalWidth = 80
const modalHeight = 7
const (
modalHeight = 7
modalWidth = 80
offscreen = -1000
)
// A Widget represents a Mercurial widget
type Widget struct {
@ -28,7 +30,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
pages: pages,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "NBA Score"
const (
defaultFocusable = true
defaultTitle = "NBA Score"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -13,6 +13,8 @@ import (
"github.com/wtfutil/wtf/view"
)
var offset = 0
// A Widget represents an NBA Score widget
type Widget struct {
view.KeyboardWidget
@ -23,13 +25,11 @@ type Widget struct {
settings *Settings
}
var offset = 0
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "NewRelic"
const (
defaultFocusable = true
defaultTitle = "NewRelic"
)
type Settings struct {
common *cfg.Common
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
deployCount: ymlConfig.UInt("deployCount", 5),

View File

@ -22,7 +22,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "applicationID", "applicationIDs"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "OpsGenie"
const (
defaultFocusable = false
defaultTitle = "OpsGenie"
)
type Settings struct {
common *cfg.Common
@ -22,7 +25,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_OPS_GENIE_API_KEY"))),
region: ymlConfig.UString("region", "us"),

View File

@ -17,7 +17,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "PagerDuty"
const (
defaultFocusable = false
defaultTitle = "PagerDuty"
)
type Settings struct {
common *cfg.Common
@ -22,7 +25,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_PAGERDUTY_API_KEY"))),
escalationFilter: ymlConfig.UList("escalationFilter"),

View File

@ -18,7 +18,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Power"
const (
defaultFocusable = false
defaultTitle = "Power"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -17,7 +17,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
Battery: NewBattery(),

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "ResourceUsage"
const (
defaultFocusable = false
defaultTitle = "ResourceUsage"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -12,8 +12,10 @@ import (
"github.com/wtfutil/wtf/view"
)
var started = false
var ok = true
var (
ok = true
started = false
)
// Widget define wtf widget to register widget later
type Widget struct {
@ -26,7 +28,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
BarGraph: view.NewBarGraph(app, settings.common.Name, settings.common, false),
BarGraph: view.NewBarGraph(app, settings.common.Name, settings.common),
app: app,
settings: settings,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Rollbar"
const (
defaultFocusable = true
defaultTitle = "Rollbar"
)
type Settings struct {
common *cfg.Common
@ -21,7 +24,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
accessToken: ymlConfig.UString("accessToken"),
activeOnly: ymlConfig.UBool("activeOnly", false),

View File

@ -22,7 +22,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Security"
const (
defaultFocusable = false
defaultTitle = "Security"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Spotify"
const (
defaultFocusable = true
defaultTitle = "Spotify"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -23,7 +23,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
Info: spotigopher.Info{},
client: spotigopher.NewClient(),

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Spotify Web"
const (
defaultFocusable = true
defaultTitle = "Spotify Web"
)
type Settings struct {
common *cfg.Common
@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
callbackPort: ymlConfig.UString("callbackPort", "8080"),
clientID: ymlConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),

View File

@ -12,6 +12,15 @@ import (
"github.com/zmb3/spotify"
)
var (
auth spotify.Authenticator
tempClientChan = make(chan *spotify.Client)
state = "wtfSpotifyWebStateString"
authURL string
callbackPort string
redirectURI string
)
// Info is the struct that contains all the information the Spotify player displays to the user
type Info struct {
Artists string
@ -34,15 +43,6 @@ type Widget struct {
settings *Settings
}
var (
auth spotify.Authenticator
tempClientChan = make(chan *spotify.Client)
state = "wtfSpotifyWebStateString"
authURL string
callbackPort string
redirectURI string
)
func authHandler(w http.ResponseWriter, r *http.Request) {
tok, err := auth.Token(state, r)
if err != nil {
@ -70,7 +70,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
Info: Info{},

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Status"
const (
defaultFocusable = false
defaultTitle = "Status"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -15,7 +15,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
CurrentIcon: 0,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "System"
const (
defaultFocusable = false
defaultTitle = "System"
)
type Settings struct {
common *cfg.Common
@ -13,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}
return &settings

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common),
Date: date,

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Textfile"
const (
defaultFocusable = true
defaultTitle = "Textfile"
)
// Settings defines the configuration properties for this module
type Settings struct {
@ -21,7 +24,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
filePaths: ymlConfig.UList("filePaths"),
format: ymlConfig.UBool("format", false),

View File

@ -34,7 +34,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "filePath", "filePaths"),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
settings: settings,
}

View File

@ -5,7 +5,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Todo"
const (
defaultFocusable = true
defaultTitle = "Todo"
)
type Settings struct {
common *cfg.Common
@ -16,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
filePath: ymlConfig.UString("filename"),
}

View File

@ -15,9 +15,9 @@ import (
)
const (
offscreen = -1000
modalWidth = 80
modalHeight = 7
modalWidth = 80
offscreen = -1000
)
// A Widget represents a Todo widget
@ -36,7 +36,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
app: app,
settings: settings,

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Todoist"
const (
defaultFocusable = true
defaultTitle = "Todoist"
)
type Settings struct {
common *cfg.Common
@ -19,7 +22,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_TODOIST_TOKEN"))),
projects: ymlConfig.UList("projects"),

View File

@ -21,7 +21,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -5,6 +5,11 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const (
defaultFocusable = true
defaultTitle = "Transmission"
)
// Settings defines the configuration properties for this module
type Settings struct {
common *cfg.Common
@ -17,14 +22,10 @@ type Settings struct {
username string `help:"The username of the Transmission user"`
}
const (
defaultTitle = "Transmission"
)
// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
host: ymlConfig.UString("host"),
https: ymlConfig.UBool("https", false),

View File

@ -23,7 +23,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "TravisCI"
const (
defaultFocusable = true
defaultTitle = "TravisCI"
)
type Settings struct {
common *cfg.Common
@ -20,9 +23,8 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_TRAVIS_API_TOKEN"))),
pro: ymlConfig.UBool("pro", false),

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
settings: settings,
}

View File

@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Trello"
const (
defaultFocusable = false
defaultTitle = "Trello"
)
type Settings struct {
common *cfg.Common
@ -20,9 +23,8 @@ type Settings struct {
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
accessToken: ymlConfig.UString("accessToken", ymlConfig.UString("apikey", os.Getenv("WTF_TRELLO_ACCESS_TOKEN"))),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TRELLO_APP_KEY")),

Some files were not shown because too many files have changed in this diff Show More