mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Simplify the inclusion of the Common config settings into each module
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
parent
f9a06540f1
commit
d6a0797bf2
@ -28,13 +28,16 @@ type Common struct {
|
|||||||
PositionSettings `help:"Defines where in the grid this module’s widget will be displayed."`
|
PositionSettings `help:"Defines where in the grid this module’s widget will be displayed."`
|
||||||
Sigils
|
Sigils
|
||||||
|
|
||||||
Colors ColorTheme
|
Colors ColorTheme
|
||||||
|
Config *config.Config
|
||||||
|
|
||||||
|
DocPath string
|
||||||
|
|
||||||
Bordered bool `help:"Whether or not the module should be displayed with a border." values:"true, false" optional:"true" default:"true"`
|
Bordered bool `help:"Whether or not the module should be displayed with a border." values:"true, false" optional:"true" default:"true"`
|
||||||
Enabled bool `help:"Whether or not this module is executed and if its data displayed onscreen." values:"true, false" optional:"true" default:"false"`
|
Enabled bool `help:"Whether or not this module is executed and if its data displayed onscreen." values:"true, false" optional:"true" default:"false"`
|
||||||
Focusable bool `help:"Whether or not this module is focusable." values:"true, false" optional:"true" default:"false"`
|
Focusable bool `help:"Whether or not this module is focusable." values:"true, false" optional:"true" default:"false"`
|
||||||
RefreshInterval int `help:"How often, in seconds, this module will update its data." values:"A positive integer, 0..n." optional:"true"`
|
RefreshInterval int `help:"How often, in seconds, this module will update its data." values:"A positive integer, 0..n." optional:"true"`
|
||||||
Title string `help:"The title string to show when displaying this module" optional:"true"`
|
Title string `help:"The title string to show when displaying this module" optional:"true"`
|
||||||
Config *config.Config
|
|
||||||
|
|
||||||
focusChar int `help:"Define one of the number keys as a short cut key to access the widget." optional:"true"`
|
focusChar int `help:"Define one of the number keys as a short cut key to access the widget." optional:"true"`
|
||||||
}
|
}
|
||||||
@ -167,6 +170,15 @@ func (common *Common) PaginationMarker(len, pos, width int) string {
|
|||||||
return sigils
|
return sigils
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetDocumentationPath is used to explicitly set the documentation path that should be opened
|
||||||
|
// when the key to open the documentation is pressed.
|
||||||
|
// Setting this is probably not necessary unless the module documentation is nested inside a
|
||||||
|
// documentation subdirectory in the /wtfutildocs repo, or the module here has a different
|
||||||
|
// name than the module's display name in the documentation (which ideally wouldn't be a thing).
|
||||||
|
func (common *Common) SetDocumentationPath(path string) {
|
||||||
|
common.DocPath = path
|
||||||
|
}
|
||||||
|
|
||||||
// Validations aggregates all the validations from all the sub-sections in Common into a
|
// Validations aggregates all the validations from all the sub-sections in Common into a
|
||||||
// single array of validations
|
// single array of validations
|
||||||
func (common *Common) Validations() []Validatable {
|
func (common *Common) Validations() []Validatable {
|
||||||
|
@ -14,7 +14,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration options for this module
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiToken string `help:"Your Azure DevOps Access Token."`
|
apiToken string `help:"Your Azure DevOps Access Token."`
|
||||||
labelColor string
|
labelColor string
|
||||||
@ -26,7 +26,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocus, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocus, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE_DEVOPS_API_TOKEN")),
|
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE_DEVOPS_API_TOKEN")),
|
||||||
labelColor: ymlConfig.UString("labelColor", "white"),
|
labelColor: ymlConfig.UString("labelColor", "white"),
|
||||||
|
@ -21,7 +21,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{
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your BambooHR API token."`
|
apiKey string `help:"Your BambooHR API token."`
|
||||||
subdomain string `help:"Your BambooHR API subdomain name."`
|
subdomain string `help:"Your BambooHR API subdomain name."`
|
||||||
@ -21,7 +21,7 @@ type Settings struct {
|
|||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_BAMBOO_HR_TOKEN"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_BAMBOO_HR_TOKEN"))),
|
||||||
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
||||||
|
@ -21,7 +21,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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -23,7 +23,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: view.NewBarGraph(app, "Sample Bar Graph", settings.common),
|
BarGraph: view.NewBarGraph(app, "Sample Bar Graph", settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ type PipelineSettings struct {
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Buildkite API Token"`
|
apiKey string `help:"Your Buildkite API Token"`
|
||||||
orgSlug string `help:"Organization Slug"`
|
orgSlug string `help:"Organization Slug"`
|
||||||
pipelines []PipelineSettings `help:"An array of pipelines to get data from"`
|
pipelines []PipelineSettings `help:"An array of pipelines to get data from"`
|
||||||
@ -30,7 +31,8 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BUILDKITE_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BUILDKITE_TOKEN")),
|
||||||
orgSlug: ymlConfig.UString("organizationSlug"),
|
orgSlug: ymlConfig.UString("organizationSlug"),
|
||||||
pipelines: buildPipelineSettings(ymlConfig),
|
pipelines: buildPipelineSettings(ymlConfig),
|
||||||
|
@ -17,7 +17,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{
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.workflows), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.workflows), widget.Idx, width) + "\n"
|
||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow))
|
||||||
|
|
||||||
str += widget.displayWorkflowRuns(workflow)
|
str += widget.displayWorkflowRuns(workflow)
|
||||||
@ -36,7 +36,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
func (widget *Widget) title(workflow *sdk.Workflow) string {
|
func (widget *Widget) title(workflow *sdk.Workflow) string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"[%s]%s/%s[white]",
|
"[%s]%s/%s[white]",
|
||||||
widget.settings.common.Colors.TextTheme.Title,
|
widget.settings.Colors.TextTheme.Title,
|
||||||
workflow.ProjectKey, workflow.Name,
|
workflow.ProjectKey, workflow.Name,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
token string `help:"Your CDS API token."`
|
token string `help:"Your CDS API token."`
|
||||||
apiURL string `help:"Your CDS API URL."`
|
apiURL string `help:"Your CDS API URL."`
|
||||||
uiURL string
|
uiURL string
|
||||||
@ -25,7 +26,8 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
||||||
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
||||||
hideTags: utils.ToStrs(ymlConfig.UList("hideTags")),
|
hideTags: utils.ToStrs(ymlConfig.UList("hideTags")),
|
||||||
|
@ -29,8 +29,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
filter := widget.currentFilter()
|
filter := widget.currentFilter()
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
|
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.filters), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.filters), widget.Idx, width) + "\n"
|
||||||
str += widget.displayQueue(filter)
|
str += widget.displayQueue(filter)
|
||||||
|
|
||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter))
|
||||||
@ -34,7 +34,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
func (widget *Widget) title(filter string) string {
|
func (widget *Widget) title(filter string) string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"[%s]%d - %s[white]",
|
"[%s]%d - %s[white]",
|
||||||
widget.settings.common.Colors.TextTheme.Title,
|
widget.settings.Colors.TextTheme.Title,
|
||||||
widget.maxItems,
|
widget.maxItems,
|
||||||
filter,
|
filter,
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,8 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
token string `help:"Your CDS API token."`
|
token string `help:"Your CDS API token."`
|
||||||
apiURL string `help:"Your CDS API URL."`
|
apiURL string `help:"Your CDS API URL."`
|
||||||
uiURL string
|
uiURL string
|
||||||
@ -23,7 +24,8 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
||||||
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your CircleCI API token."`
|
apiKey string `help:"Your CircleCI API token."`
|
||||||
numberOfBuilds int `help:"The number of build, 10 by default"`
|
numberOfBuilds int `help:"The number of build, 10 by default"`
|
||||||
@ -22,7 +22,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_CIRCLE_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_CIRCLE_API_KEY"))),
|
||||||
numberOfBuilds: ymlConfig.UInt("numberOfBuilds", 10),
|
numberOfBuilds: ymlConfig.UInt("numberOfBuilds", 10),
|
||||||
|
@ -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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
Client: NewClient(settings.apiKey),
|
Client: NewClient(settings.apiKey),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
dateFormat string `help:"The format of the date string for all clocks." values:"Any valid Go date layout which is handled by Time.Format. Defaults to Jan 2."`
|
dateFormat string `help:"The format of the date string for all clocks." values:"Any valid Go date layout which is handled by Time.Format. Defaults to Jan 2."`
|
||||||
timeFormat string `help:"The format of the time string for all clocks." values:"Any valid Go time layout which is handled by Time.Format. Defaults to 15:04 MST."`
|
timeFormat string `help:"The format of the time string for all clocks." values:"Any valid Go time layout which is handled by Time.Format. Defaults to 15:04 MST."`
|
||||||
@ -24,7 +24,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
dateFormat: ymlConfig.UString("dateFormat", utils.SimpleDateFormat),
|
dateFormat: ymlConfig.UString("dateFormat", utils.SimpleDateFormat),
|
||||||
timeFormat: ymlConfig.UString("timeFormat", utils.SimpleTimeFormat),
|
timeFormat: ymlConfig.UString("timeFormat", utils.SimpleTimeFormat),
|
||||||
|
@ -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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
|
|
||||||
// Settings for the cmdrunner widget
|
// Settings for the cmdrunner widget
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
args []string `help:"The arguments to the command, with each item as an element in an array. Example: for curl -I cisco.com, the arguments array would be ['-I', 'cisco.com']."`
|
args []string `help:"The arguments to the command, with each item as an element in an array. Example: for curl -I cisco.com, the arguments array would be ['-I', 'cisco.com']."`
|
||||||
cmd string `help:"The terminal command to be run, withouth the arguments. Ie: ping, whoami, curl."`
|
cmd string `help:"The terminal command to be run, withouth the arguments. Ie: ping, whoami, curl."`
|
||||||
@ -29,7 +29,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML loads the cmdrunner portion of the WTF config
|
// NewSettingsFromYAML loads the cmdrunner portion of the WTF config
|
||||||
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
|
||||||
|
|
||||||
args: utils.ToStrs(moduleConfig.UList("args")),
|
args: utils.ToStrs(moduleConfig.UList("args")),
|
||||||
cmd: moduleConfig.UString("cmd"),
|
cmd: moduleConfig.UString("cmd"),
|
||||||
|
@ -29,7 +29,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
buffer: &bytes.Buffer{},
|
buffer: &bytes.Buffer{},
|
||||||
|
@ -32,15 +32,16 @@ type summary struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
*cfg.Common
|
||||||
|
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
|
||||||
summary
|
summary
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.base.name = ymlConfig.UString("colors.base.name")
|
settings.colors.base.name = ymlConfig.UString("colors.base.name")
|
||||||
|
@ -31,7 +31,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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
summaryList: summaryList{},
|
summaryList: summaryList{},
|
||||||
|
@ -17,8 +17,9 @@ type colors struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
*cfg.Common
|
||||||
|
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
|
||||||
|
|
||||||
deviceToken string
|
deviceToken string
|
||||||
displayHoldings bool
|
displayHoldings bool
|
||||||
@ -27,7 +28,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
deviceToken: ymlConfig.UString("device_token"),
|
deviceToken: ymlConfig.UString("device_token"),
|
||||||
displayHoldings: ymlConfig.UBool("displayHoldings", true),
|
displayHoldings: ymlConfig.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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
device_token: settings.deviceToken,
|
device_token: settings.deviceToken,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -38,15 +38,16 @@ type currency struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
*cfg.Common
|
||||||
|
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
|
||||||
currencies map[string]*currency
|
currencies map[string]*currency
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||||
|
@ -35,8 +35,9 @@ type colors struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
*cfg.Common
|
||||||
|
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
|
||||||
|
|
||||||
currencies map[string]interface{}
|
currencies map[string]interface{}
|
||||||
top map[string]interface{}
|
top map[string]interface{}
|
||||||
@ -50,7 +51,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
top, _ := ymlConfig.Map("top")
|
top, _ := ymlConfig.Map("top")
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
currencies: currencies,
|
currencies: currencies,
|
||||||
top: top,
|
top: top,
|
||||||
|
@ -39,15 +39,16 @@ type currency struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
*cfg.Common
|
||||||
|
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
top map[string]*currency
|
||||||
top map[string]*currency
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||||
|
@ -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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
priceWidget: price.NewWidget(settings.priceSettings),
|
priceWidget: price.NewWidget(settings.priceSettings),
|
||||||
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Datadog API key."`
|
apiKey string `help:"Your Datadog API key."`
|
||||||
applicationKey string `help:"Your Datadog Application key."`
|
applicationKey string `help:"Your Datadog Application key."`
|
||||||
@ -23,7 +23,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_DATADOG_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_DATADOG_API_KEY"))),
|
||||||
applicationKey: ymlConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),
|
applicationKey: ymlConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),
|
||||||
|
@ -19,7 +19,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
" %s\n",
|
" %s\n",
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"[%s]Triggered Monitors[white]",
|
"[%s]Triggered Monitors[white]",
|
||||||
widget.settings.common.Colors.Subheading,
|
widget.settings.Colors.Subheading,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
for idx, triggeredMonitor := range triggeredMonitors {
|
for idx, triggeredMonitor := range triggeredMonitors {
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration options for this module
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
numberOfArticles int `help:"Number of stories to show. Default is 10" optional:"true"`
|
numberOfArticles int `help:"Number of stories to show. Default is 10" optional:"true"`
|
||||||
contentTag string `help:"List articles from a specific tag. Default is empty" optional:"true"`
|
contentTag string `help:"List articles from a specific tag. Default is empty" optional:"true"`
|
||||||
@ -24,7 +24,8 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, yamlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, yamlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, yamlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, yamlConfig, globalConfig),
|
||||||
|
|
||||||
numberOfArticles: yamlConfig.UInt("numberOfArticles", 10),
|
numberOfArticles: yamlConfig.UInt("numberOfArticles", 10),
|
||||||
contentTag: yamlConfig.UString("contentTag", ""),
|
contentTag: yamlConfig.UString("contentTag", ""),
|
||||||
contentUsername: yamlConfig.UString("contentUsername", ""),
|
contentUsername: yamlConfig.UString("contentUsername", ""),
|
||||||
|
@ -21,7 +21,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
color string `help:"The color of the clock."`
|
color string `help:"The color of the clock."`
|
||||||
font string `help:"The font of the clock." values:"bigfont or digitalfont"`
|
font string `help:"The font of the clock." values:"bigfont or digitalfont"`
|
||||||
@ -23,7 +23,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
color: ymlConfig.UString("color"),
|
color: ymlConfig.UString("color"),
|
||||||
font: ymlConfig.UString("font"),
|
font: ymlConfig.UString("font"),
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new widget using settings
|
// NewWidget creates a new widget using settings
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -20,7 +20,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
return title, " no columns defined", false
|
return title, " no columns defined", false
|
||||||
}
|
}
|
||||||
|
|
||||||
str := fmt.Sprintf(" [::b][%s]", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [::b][%s]", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
for _, colName := range columnSet {
|
for _, colName := range columnSet {
|
||||||
truncName := utils.Truncate(colName, maxColWidth, false)
|
truncName := utils.Truncate(colName, maxColWidth, false)
|
||||||
|
@ -24,7 +24,7 @@ var defaultColumns = []interface{}{
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your DigitalOcean API key."`
|
apiKey string `help:"Your DigitalOcean API key."`
|
||||||
columns []string `help:"A list of the droplet properties to display."`
|
columns []string `help:"A list of the droplet properties to display."`
|
||||||
@ -35,7 +35,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_DIGITALOCEAN_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_DIGITALOCEAN_API_KEY"))),
|
||||||
columns: utils.ToStrs(ymlConfig.UList("columns", defaultColumns)),
|
columns: utils.ToStrs(ymlConfig.UList("columns", defaultColumns)),
|
||||||
|
@ -44,7 +44,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
|
@ -41,13 +41,13 @@ func (widget *Widget) getSystemInfo() string {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "name:",
|
name: "name:",
|
||||||
value: fmt.Sprintf("[%s]%s", widget.settings.common.Colors.RowTheme.EvenForeground, info.Name),
|
value: fmt.Sprintf("[%s]%s", widget.settings.Colors.RowTheme.EvenForeground, info.Name),
|
||||||
}, {
|
}, {
|
||||||
name: "version:",
|
name: "version:",
|
||||||
value: fmt.Sprintf("[%s]%s", widget.settings.common.Colors.RowTheme.EvenForeground, info.ServerVersion),
|
value: fmt.Sprintf("[%s]%s", widget.settings.Colors.RowTheme.EvenForeground, info.ServerVersion),
|
||||||
}, {
|
}, {
|
||||||
name: "root:",
|
name: "root:",
|
||||||
value: fmt.Sprintf("[%s]%s", widget.settings.common.Colors.RowTheme.EvenForeground, info.DockerRootDir),
|
value: fmt.Sprintf("[%s]%s", widget.settings.Colors.RowTheme.EvenForeground, info.DockerRootDir),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "containers:",
|
name: "containers:",
|
||||||
@ -57,15 +57,15 @@ func (widget *Widget) getSystemInfo() string {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "images:",
|
name: "images:",
|
||||||
value: fmt.Sprintf("[%s]%d", widget.settings.common.Colors.RowTheme.EvenForeground, info.Images),
|
value: fmt.Sprintf("[%s]%d", widget.settings.Colors.RowTheme.EvenForeground, info.Images),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "volumes:",
|
name: "volumes:",
|
||||||
value: fmt.Sprintf("[%s]%v", widget.settings.common.Colors.RowTheme.EvenForeground, len(diskUsage.Volumes)),
|
value: fmt.Sprintf("[%s]%v", widget.settings.Colors.RowTheme.EvenForeground, len(diskUsage.Volumes)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "memory limit:",
|
name: "memory limit:",
|
||||||
value: fmt.Sprintf("[%s]%s", widget.settings.common.Colors.RowTheme.EvenForeground, humanize.Bytes(uint64(info.MemTotal))),
|
value: fmt.Sprintf("[%s]%s", widget.settings.Colors.RowTheme.EvenForeground, humanize.Bytes(uint64(info.MemTotal))),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "disk usage:",
|
name: "disk usage:",
|
||||||
@ -76,19 +76,19 @@ func (widget *Widget) getSystemInfo() string {
|
|||||||
[%s]* [::b]total: [%s]%s[::-]
|
[%s]* [::b]total: [%s]%s[::-]
|
||||||
`,
|
`,
|
||||||
widget.settings.labelColor,
|
widget.settings.labelColor,
|
||||||
widget.settings.common.Colors.RowTheme.EvenForeground,
|
widget.settings.Colors.RowTheme.EvenForeground,
|
||||||
humanize.Bytes(uint64(duContainer)),
|
humanize.Bytes(uint64(duContainer)),
|
||||||
|
|
||||||
widget.settings.labelColor,
|
widget.settings.labelColor,
|
||||||
widget.settings.common.Colors.RowTheme.EvenForeground,
|
widget.settings.Colors.RowTheme.EvenForeground,
|
||||||
humanize.Bytes(uint64(duImg)),
|
humanize.Bytes(uint64(duImg)),
|
||||||
|
|
||||||
widget.settings.labelColor,
|
widget.settings.labelColor,
|
||||||
widget.settings.common.Colors.RowTheme.EvenForeground,
|
widget.settings.Colors.RowTheme.EvenForeground,
|
||||||
humanize.Bytes(uint64(duVol)),
|
humanize.Bytes(uint64(duVol)),
|
||||||
|
|
||||||
widget.settings.labelColor,
|
widget.settings.labelColor,
|
||||||
widget.settings.common.Colors.RowTheme.EvenForeground,
|
widget.settings.Colors.RowTheme.EvenForeground,
|
||||||
humanize.Bytes(uint64(duContainer+duImg+duVol))),
|
humanize.Bytes(uint64(duContainer+duImg+duVol))),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,15 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration options for this module
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
labelColor string
|
labelColor string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
labelColor: ymlConfig.UString("labelColor", "white"),
|
labelColor: ymlConfig.UString("labelColor", "white"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,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{
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,11 +56,11 @@ func (widget *Widget) refreshDisplayBuffer() {
|
|||||||
|
|
||||||
widget.displayBuffer = ""
|
widget.displayBuffer = ""
|
||||||
|
|
||||||
widget.displayBuffer += fmt.Sprintf("[%s] System[white]\n", widget.settings.common.Colors.Subheading)
|
widget.displayBuffer += fmt.Sprintf("[%s] System[white]\n", widget.settings.Colors.Subheading)
|
||||||
widget.displayBuffer += widget.getSystemInfo()
|
widget.displayBuffer += widget.getSystemInfo()
|
||||||
|
|
||||||
widget.displayBuffer += "\n"
|
widget.displayBuffer += "\n"
|
||||||
|
|
||||||
widget.displayBuffer += fmt.Sprintf("[%s] Containers[white]\n", widget.settings.common.Colors.Subheading)
|
widget.displayBuffer += fmt.Sprintf("[%s] Containers[white]\n", widget.settings.Colors.Subheading)
|
||||||
widget.displayBuffer += widget.getContainerStates()
|
widget.displayBuffer += widget.getContainerStates()
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
precision int `help:"How many decimal places to display." optional:"true"`
|
precision int `help:"How many decimal places to display." optional:"true"`
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
precision: ymlConfig.UInt("precision", 7),
|
precision: ymlConfig.UInt("precision", 7),
|
||||||
|
|
||||||
|
@ -20,7 +20,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
feeds []string `help:"An array of RSS and Atom feed URLs"`
|
feeds []string `help:"An array of RSS and Atom feed URLs"`
|
||||||
feedLimit int `help:"The maximum number of stories to display for each feed"`
|
feedLimit int `help:"The maximum number of stories to display for each feed"`
|
||||||
@ -22,7 +22,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := &Settings{
|
settings := &Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
feeds: utils.ToStrs(ymlConfig.UList("feeds")),
|
feeds: utils.ToStrs(ymlConfig.UList("feeds")),
|
||||||
feedLimit: ymlConfig.UInt("feedLimit", -1),
|
feedLimit: ymlConfig.UInt("feedLimit", -1),
|
||||||
|
@ -65,7 +65,7 @@ func getShowText(feedItem *FeedItem, showType ShowType) string {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
parser: gofeed.NewParser(),
|
parser: gofeed.NewParser(),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
@ -165,7 +165,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
// Grays out viewed items in the list, while preserving background highlighting when selected
|
// Grays out viewed items in the list, while preserving background highlighting when selected
|
||||||
rowColor = "gray"
|
rowColor = "gray"
|
||||||
if idx == widget.Selected {
|
if idx == widget.Selected {
|
||||||
rowColor = fmt.Sprintf("gray:%s", widget.settings.common.Colors.RowTheme.HighlightedBackground)
|
rowColor = fmt.Sprintf("gray:%s", widget.settings.Colors.RowTheme.HighlightedBackground)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your finnhub API token."`
|
apiKey string `help:"Your finnhub API token."`
|
||||||
symbols []string `help:"An array of stocks symbols (i.e. AAPL, MSFT)"`
|
symbols []string `help:"An array of stocks symbols (i.e. AAPL, MSFT)"`
|
||||||
}
|
}
|
||||||
@ -24,7 +25,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_FINNHUB_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_FINNHUB_API_KEY"))),
|
||||||
symbols: utils.ToStrs(ymlConfig.UList("symbols")),
|
symbols: utils.ToStrs(ymlConfig.UList("symbols")),
|
||||||
|
@ -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{
|
||||||
Client: NewClient(settings.symbols, settings.apiKey),
|
Client: NewClient(settings.symbols, settings.apiKey),
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Football-data API token."`
|
apiKey string `help:"Your Football-data API token."`
|
||||||
league string `help:"Name of the competition. For example PL"`
|
league string `help:"Name of the competition. For example PL"`
|
||||||
favTeam string `help:"Teams to follow in mentioned league"`
|
favTeam string `help:"Teams to follow in mentioned league"`
|
||||||
@ -25,7 +26,8 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_FOOTBALL_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_FOOTBALL_API_KEY"))),
|
||||||
league: ymlConfig.UString("league", ymlConfig.UString("league", os.Getenv("WTF_FOOTBALL_LEAGUE"))),
|
league: ymlConfig.UString("league", ymlConfig.UString("league", os.Getenv("WTF_FOOTBALL_LEAGUE"))),
|
||||||
favTeam: ymlConfig.UString("favTeam", ymlConfig.UString("favTeam", os.Getenv("WTF_FOOTBALL_TEAM"))),
|
favTeam: ymlConfig.UString("favTeam", ymlConfig.UString("favTeam", os.Getenv("WTF_FOOTBALL_TEAM"))),
|
||||||
|
@ -51,7 +51,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget = Widget{
|
widget = Widget{
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
Client: NewClient(settings.apiKey),
|
Client: NewClient(settings.apiKey),
|
||||||
League: leagueId,
|
League: leagueId,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -14,7 +14,7 @@ func (widget *Widget) display() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
title := widget.settings.common.Title
|
title := widget.settings.Title
|
||||||
calEvents := widget.calEvents
|
calEvents := widget.calEvents
|
||||||
|
|
||||||
if widget.err != nil {
|
if widget.err != nil {
|
||||||
|
@ -21,25 +21,25 @@ func Test_display_content(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Event content without any events",
|
name: "Event content without any events",
|
||||||
settings: &Settings{common: &cfg.Common{}},
|
settings: &Settings{Common: &cfg.Common{}},
|
||||||
events: nil,
|
events: nil,
|
||||||
descriptionWanted: "No calendar events",
|
descriptionWanted: "No calendar events",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Event content with a single event, without end times displayed",
|
name: "Event content with a single event, without end times displayed",
|
||||||
settings: &Settings{common: &cfg.Common{}, showEndTime: false},
|
settings: &Settings{Common: &cfg.Common{}, showEndTime: false},
|
||||||
events: []*CalEvent{NewCalEvent(event)},
|
events: []*CalEvent{NewCalEvent(event)},
|
||||||
descriptionWanted: "[]Saturday, Apr 19\n []01:00 []Foo[white]\n \n",
|
descriptionWanted: "[]Saturday, Apr 19\n []01:00 []Foo[white]\n \n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Event content with a single event without showEndTime explictily set in settings",
|
name: "Event content with a single event without showEndTime explictily set in settings",
|
||||||
settings: &Settings{common: &cfg.Common{}},
|
settings: &Settings{Common: &cfg.Common{}},
|
||||||
events: []*CalEvent{NewCalEvent(event)},
|
events: []*CalEvent{NewCalEvent(event)},
|
||||||
descriptionWanted: "[]Saturday, Apr 19\n []01:00 []Foo[white]\n \n",
|
descriptionWanted: "[]Saturday, Apr 19\n []01:00 []Foo[white]\n \n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Event content with a single event with end times displayed",
|
name: "Event content with a single event with end times displayed",
|
||||||
settings: &Settings{common: &cfg.Common{}, showEndTime: true},
|
settings: &Settings{Common: &cfg.Common{}, showEndTime: true},
|
||||||
events: []*CalEvent{NewCalEvent(event)},
|
events: []*CalEvent{NewCalEvent(event)},
|
||||||
descriptionWanted: "[]Saturday, Apr 19\n []01:00-02:00 []Foo[white]\n \n",
|
descriptionWanted: "[]Saturday, Apr 19\n []01:00-02:00 []Foo[white]\n \n",
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@ type colors struct {
|
|||||||
// Settings defines the configuration options for this module
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
conflictIcon string `help:"The icon displayed beside calendar events that have conflicting times (they intersect or overlap in some way)." values:"Any displayable unicode character." optional:"true"`
|
conflictIcon string `help:"The icon displayed beside calendar events that have conflicting times (they intersect or overlap in some way)." values:"Any displayable unicode character." optional:"true"`
|
||||||
currentIcon string `help:"The icon displayed beside the current calendar event." values:"Any displayable unicode character." optional:"true"`
|
currentIcon string `help:"The icon displayed beside the current calendar event." values:"Any displayable unicode character." optional:"true"`
|
||||||
@ -44,7 +44,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
|
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
|
||||||
currentIcon: ymlConfig.UString("currentIcon", "🔸"),
|
currentIcon: ymlConfig.UString("currentIcon", "🔸"),
|
||||||
@ -62,8 +62,9 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
calendarReadLevel: ymlConfig.UString("calendarReadLevel", "writer"),
|
calendarReadLevel: ymlConfig.UString("calendarReadLevel", "writer"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.day = ymlConfig.UString("colors.day", settings.common.Colors.Subheading)
|
settings.colors.day = ymlConfig.UString("colors.day", settings.Colors.Subheading)
|
||||||
settings.colors.description = ymlConfig.UString("colors.description", "white")
|
settings.colors.description = ymlConfig.UString("colors.description", "white")
|
||||||
|
|
||||||
// settings.colors.eventTime is a new feature introduced via issue #638. Prior to this, the color of the event
|
// settings.colors.eventTime is a new feature introduced via issue #638. Prior to this, the color of the event
|
||||||
// time was (unintentionally) customized via settings.colors.description. To maintain backwards compatibility
|
// time was (unintentionally) customized via settings.colors.description. To maintain backwards compatibility
|
||||||
// for users who might be already using this to set the color of the event time, we try to determine the default
|
// for users who might be already using this to set the color of the event time, we try to determine the default
|
||||||
@ -72,6 +73,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
//
|
//
|
||||||
// PS: We should have a deprecation plan for supporting this backwards compatibility feature.
|
// PS: We should have a deprecation plan for supporting this backwards compatibility feature.
|
||||||
settings.colors.eventTime = ymlConfig.UString("colors.eventTime", settings.colors.description)
|
settings.colors.eventTime = ymlConfig.UString("colors.eventTime", settings.colors.description)
|
||||||
|
|
||||||
settings.colors.highlights = ymlConfig.UList("colors.highlights")
|
settings.colors.highlights = ymlConfig.UList("colors.highlights")
|
||||||
settings.colors.past = ymlConfig.UString("colors.past", "gray")
|
settings.colors.past = ymlConfig.UString("colors.past", "gray")
|
||||||
settings.colors.title = ymlConfig.UString("colors.title", "white")
|
settings.colors.title = ymlConfig.UString("colors.title", "white")
|
||||||
|
@ -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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -22,14 +22,14 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]Open Incoming Reviews[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Open Incoming Reviews[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyIncomingReviews(project, widget.settings.username)
|
str += widget.displayMyIncomingReviews(project, widget.settings.username)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]My Outgoing Reviews[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]My Outgoing Reviews[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyOutgoingReviews(project, widget.settings.username)
|
str += widget.displayMyOutgoingReviews(project, widget.settings.username)
|
||||||
|
|
||||||
return title, str, false
|
return title, str, false
|
||||||
@ -72,10 +72,10 @@ func (widget *Widget) displayStats(project *GerritProject) string {
|
|||||||
|
|
||||||
func (widget *Widget) rowColor(idx int) string {
|
func (widget *Widget) rowColor(idx int) string {
|
||||||
if widget.View.HasFocus() && (idx == widget.selected) {
|
if widget.View.HasFocus() && (idx == widget.selected) {
|
||||||
return widget.settings.common.DefaultFocusedRowColor()
|
return widget.settings.DefaultFocusedRowColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
return widget.settings.common.RowColor(idx)
|
return widget.settings.RowColor(idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) title(project *GerritProject) string {
|
func (widget *Widget) title(project *GerritProject) string {
|
||||||
|
@ -21,7 +21,7 @@ type colors struct {
|
|||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
domain string `help:"Your Gerrit corporate domain."`
|
domain string `help:"Your Gerrit corporate domain."`
|
||||||
password string `help:"Your Gerrit HTTP Password."`
|
password string `help:"Your Gerrit HTTP Password."`
|
||||||
@ -32,7 +32,7 @@ type Settings struct {
|
|||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
domain: ymlConfig.UString("domain", ""),
|
domain: ymlConfig.UString("domain", ""),
|
||||||
password: ymlConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),
|
password: ymlConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),
|
||||||
|
@ -31,7 +31,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{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
Idx: 0,
|
Idx: 0,
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.GitRepos), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.GitRepos), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Branch[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Branch[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += fmt.Sprintf(" %s", repoData.Branch)
|
str += fmt.Sprintf(" %s", repoData.Branch)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += widget.formatChanges(repoData.ChangedFiles)
|
str += widget.formatChanges(repoData.ChangedFiles)
|
||||||
@ -35,7 +35,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatChanges(data []string) string {
|
func (widget *Widget) formatChanges(data []string) string {
|
||||||
str := fmt.Sprintf(" [%s]Changed Files[white]\n", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [%s]Changed Files[white]\n", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
if len(data) == 1 {
|
if len(data) == 1 {
|
||||||
str += " [grey]none[white]\n"
|
str += " [grey]none[white]\n"
|
||||||
@ -72,7 +72,7 @@ func (widget *Widget) formatChange(line string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatCommits(data []string) string {
|
func (widget *Widget) formatCommits(data []string) string {
|
||||||
str := fmt.Sprintf(" [%s]Recent Commits[white]\n", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [%s]Recent Commits[white]\n", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str += widget.formatCommit(line)
|
str += widget.formatCommit(line)
|
||||||
|
@ -12,7 +12,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
commitCount int `help:"The number of past commits to display." values:"A positive integer, 0..n." optional:"true"`
|
commitCount int `help:"The number of past commits to display." values:"A positive integer, 0..n." optional:"true"`
|
||||||
commitFormat string `help:"The string format for the commit message." optional:"true"`
|
commitFormat string `help:"The string format for the commit message." optional:"true"`
|
||||||
@ -22,7 +22,7 @@ type Settings struct {
|
|||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
commitCount: ymlConfig.UInt("commitCount", 10),
|
commitCount: ymlConfig.UInt("commitCount", 10),
|
||||||
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),
|
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),
|
||||||
|
@ -30,8 +30,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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
|
@ -35,21 +35,21 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.GithubRepos), widget.Idx, width)
|
str := widget.settings.PaginationMarker(len(widget.GithubRepos), widget.Idx, width)
|
||||||
if widget.settings.showStats {
|
if widget.settings.showStats {
|
||||||
str += fmt.Sprintf("\n [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf("\n [%s]Stats[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayStats(repo)
|
str += widget.displayStats(repo)
|
||||||
}
|
}
|
||||||
if widget.settings.showOpenReviewRequests {
|
if widget.settings.showOpenReviewRequests {
|
||||||
str += fmt.Sprintf("\n [%s]Open Review Requests[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf("\n [%s]Open Review Requests[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyReviewRequests(repo, username)
|
str += widget.displayMyReviewRequests(repo, username)
|
||||||
}
|
}
|
||||||
if widget.settings.showMyPullRequests {
|
if widget.settings.showMyPullRequests {
|
||||||
str += fmt.Sprintf("\n [%s]My Pull Requests[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf("\n [%s]My Pull Requests[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyPullRequests(repo, username)
|
str += widget.displayMyPullRequests(repo, username)
|
||||||
}
|
}
|
||||||
for _, customQuery := range widget.settings.customQueries {
|
for _, customQuery := range widget.settings.customQueries {
|
||||||
str += fmt.Sprintf("\n [%s]%s[white]\n", widget.settings.common.Colors.Subheading, customQuery.title)
|
str += fmt.Sprintf("\n [%s]%s[white]\n", widget.settings.Colors.Subheading, customQuery.title)
|
||||||
str += widget.displayCustomQuery(repo, customQuery.filter, customQuery.perPage)
|
str += widget.displayCustomQuery(repo, customQuery.filter, customQuery.perPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ func (widget *Widget) displayStats(repo *Repo) string {
|
|||||||
func (widget *Widget) title(repo *Repo) string {
|
func (widget *Widget) title(repo *Repo) string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"[%s]%s - %s[white]",
|
"[%s]%s - %s[white]",
|
||||||
widget.settings.common.Colors.TextTheme.Title,
|
widget.settings.Colors.TextTheme.Title,
|
||||||
repo.Owner,
|
repo.Owner,
|
||||||
repo.Name,
|
repo.Name,
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your GitHub API token."`
|
apiKey string `help:"Your GitHub API token."`
|
||||||
baseURL string `help:"Your GitHub Enterprise API URL." optional:"true"`
|
baseURL string `help:"Your GitHub Enterprise API URL." optional:"true"`
|
||||||
@ -37,7 +37,7 @@ type customQuery struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITHUB_TOKEN"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITHUB_TOKEN"))),
|
||||||
baseURL: ymlConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),
|
baseURL: ymlConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),
|
||||||
|
@ -25,8 +25,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -39,20 +39,20 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(project))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(project))
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]Open Assigned Merge Requests[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Open Assigned Merge Requests[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyAssignedMergeRequests(project, widget.settings.username)
|
str += widget.displayMyAssignedMergeRequests(project, widget.settings.username)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]My Merge Requests[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]My Merge Requests[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyMergeRequests(project, widget.settings.username)
|
str += widget.displayMyMergeRequests(project, widget.settings.username)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]Open Assigned Issues[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Open Assigned Issues[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyAssignedIssues(project, widget.settings.username)
|
str += widget.displayMyAssignedIssues(project, widget.settings.username)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += fmt.Sprintf(" [%s]My Issues[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]My Issues[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += widget.displayMyIssues(project, widget.settings.username)
|
str += widget.displayMyIssues(project, widget.settings.username)
|
||||||
|
|
||||||
return title, str, false
|
return title, str, false
|
||||||
|
@ -14,7 +14,7 @@ const (
|
|||||||
|
|
||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"A GitLab personal access token. Requires at least api access."`
|
apiKey string `help:"A GitLab personal access token. Requires at least api access."`
|
||||||
domain string `help:"Your GitLab corporate domain."`
|
domain string `help:"Your GitLab corporate domain."`
|
||||||
@ -25,7 +25,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITLAB_TOKEN"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_GITLAB_TOKEN"))),
|
||||||
domain: ymlConfig.UString("domain", "https://gitlab.com"),
|
domain: ymlConfig.UString("domain", "https://gitlab.com"),
|
||||||
|
@ -33,8 +33,8 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
context, err := newContext(settings)
|
context, err := newContext(settings)
|
||||||
|
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
context: context,
|
context: context,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
numberOfTodos int `help:"Defines number of stories to be displayed. Default is 10" optional:"true"`
|
numberOfTodos int `help:"Defines number of stories to be displayed. Default is 10" optional:"true"`
|
||||||
apiKey string `help:"A GitLab personal access token. Requires at least api access."`
|
apiKey string `help:"A GitLab personal access token. Requires at least api access."`
|
||||||
@ -24,7 +24,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
numberOfTodos: ymlConfig.UInt("numberOfTodos", 10),
|
numberOfTodos: ymlConfig.UInt("numberOfTodos", 10),
|
||||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
|
||||||
|
@ -20,7 +20,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiToken string `help:"Your Gitter Personal Access Token."`
|
apiToken string `help:"Your Gitter Personal Access Token."`
|
||||||
numberOfMessages int `help:"Maximum number of (newest) messages to be displayed. Default is 10" optional:"true"`
|
numberOfMessages int `help:"Maximum number of (newest) messages to be displayed. Default is 10" optional:"true"`
|
||||||
@ -23,7 +23,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
|
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
|
||||||
numberOfMessages: ymlConfig.UInt("numberOfMessages", 10),
|
numberOfMessages: ymlConfig.UInt("numberOfMessages", 10),
|
||||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
months int
|
months int
|
||||||
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
||||||
@ -22,7 +22,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
months: ymlConfig.UInt("months"),
|
months: ymlConfig.UInt("months"),
|
||||||
secretFile: ymlConfig.UString("secretFile"),
|
secretFile: ymlConfig.UString("secretFile"),
|
||||||
|
@ -13,7 +13,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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Grafana API token."`
|
apiKey string `help:"Your Grafana API token."`
|
||||||
baseURI string `help:"Base url of your grafana instance"`
|
baseURI string `help:"Base url of your grafana instance"`
|
||||||
@ -24,7 +24,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GRAFANA_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GRAFANA_API_KEY")),
|
||||||
baseURI: ymlConfig.UString("baseUri", ""),
|
baseURI: ymlConfig.UString("baseUri", ""),
|
||||||
|
@ -22,7 +22,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{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
Client: NewClient(settings),
|
Client: NewClient(settings),
|
||||||
Selected: -1,
|
Selected: -1,
|
||||||
|
@ -16,7 +16,7 @@ type colors struct {
|
|||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
cellAddresses []interface{}
|
cellAddresses []interface{}
|
||||||
cellNames []interface{}
|
cellNames []interface{}
|
||||||
@ -27,7 +27,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
cellNames: ymlConfig.UList("cells.names"),
|
cellNames: ymlConfig.UList("cells.names"),
|
||||||
secretFile: ymlConfig.UString("secretFile"),
|
secretFile: ymlConfig.UString("secretFile"),
|
||||||
|
@ -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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
numberOfStories int `help:"Defines number of stories to be displayed. Default is 10" optional:"true"`
|
numberOfStories int `help:"Defines number of stories to be displayed. Default is 10" optional:"true"`
|
||||||
storyType string `help:"Category of story to see" values:"new, top, job, ask" optional:"true"`
|
storyType string `help:"Category of story to see" values:"new, top, job, ask" optional:"true"`
|
||||||
@ -20,7 +20,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
numberOfStories: ymlConfig.UInt("numberOfStories", 10),
|
numberOfStories: ymlConfig.UInt("numberOfStories", 10),
|
||||||
storyType: ymlConfig.UString("storyType", "top"),
|
storyType: ymlConfig.UString("storyType", "top"),
|
||||||
|
@ -20,7 +20,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ type colors struct {
|
|||||||
// Settings defines the configuration properties for this module
|
// Settings defines the configuration properties for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
accounts []string `help:"A list of the accounts to check the HIBP database for."`
|
accounts []string `help:"A list of the accounts to check the HIBP database for."`
|
||||||
apiKey string `help:"Your HIBP API v3 API key"`
|
apiKey string `help:"Your HIBP API v3 API key"`
|
||||||
@ -33,7 +33,7 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := &Settings{
|
settings := &Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_HIBP_TOKEN"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_HIBP_TOKEN"))),
|
||||||
accounts: utils.ToStrs(ymlConfig.UList("accounts")),
|
accounts: utils.ToStrs(ymlConfig.UList("accounts")),
|
||||||
@ -47,8 +47,8 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
|
|
||||||
// HIBP data doesn't need to be reloaded very often so to be gentle on this API we
|
// HIBP data doesn't need to be reloaded very often so to be gentle on this API we
|
||||||
// enforce a minimum refresh interval
|
// enforce a minimum refresh interval
|
||||||
if settings.common.RefreshInterval < minRefreshInterval {
|
if settings.RefreshInterval < minRefreshInterval {
|
||||||
settings.common.RefreshInterval = minRefreshInterval
|
settings.RefreshInterval = minRefreshInterval
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@ type colors struct {
|
|||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.name = ymlConfig.UString("colors.name", "red")
|
settings.colors.name = ymlConfig.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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -32,7 +32,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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -96,8 +96,8 @@ func (widget *Widget) setResult(info *ipinfo) {
|
|||||||
resultBuffer := new(bytes.Buffer)
|
resultBuffer := new(bytes.Buffer)
|
||||||
|
|
||||||
err := resultTemplate.Execute(resultBuffer, map[string]string{
|
err := resultTemplate.Execute(resultBuffer, map[string]string{
|
||||||
"subheadingColor": widget.settings.common.Colors.Subheading,
|
"subheadingColor": widget.settings.Colors.Subheading,
|
||||||
"valueColor": widget.settings.common.Colors.Text,
|
"valueColor": widget.settings.Colors.Text,
|
||||||
"Ip": info.Ip,
|
"Ip": info.Ip,
|
||||||
"Hostname": info.Hostname,
|
"Hostname": info.Hostname,
|
||||||
"City": info.City,
|
"City": info.City,
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Jenkins API key."`
|
apiKey string `help:"Your Jenkins API key."`
|
||||||
jobNameRegex string `help:"A regex that filters the jobs shown in the widget." optional:"true"`
|
jobNameRegex string `help:"A regex that filters the jobs shown in the widget." optional:"true"`
|
||||||
@ -26,7 +26,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JENKINS_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JENKINS_API_KEY"))),
|
||||||
jobNameRegex: ymlConfig.UString("jobNameRegex", ".*"),
|
jobNameRegex: ymlConfig.UString("jobNameRegex", ".*"),
|
||||||
|
@ -19,7 +19,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ type colors struct {
|
|||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your Jira API key (or password for basic auth)."`
|
apiKey string `help:"Your Jira API key (or password for basic auth)."`
|
||||||
domain string `help:"Your Jira corporate domain."`
|
domain string `help:"Your Jira corporate domain."`
|
||||||
@ -35,7 +35,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JIRA_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_JIRA_API_KEY"))),
|
||||||
domain: ymlConfig.UString("domain"),
|
domain: ymlConfig.UString("domain"),
|
||||||
|
@ -18,7 +18,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{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
|
|
||||||
title := widget.CommonSettings().Title
|
title := widget.CommonSettings().Title
|
||||||
|
|
||||||
str := fmt.Sprintf(" [%s]Assigned Issues[white]\n", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [%s]Assigned Issues[white]\n", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
if widget.result == nil || len(widget.result.Issues) == 0 {
|
if widget.result == nil || len(widget.result.Issues) == 0 {
|
||||||
return title, "No results to display", false
|
return title, "No results to display", false
|
||||||
|
@ -12,7 +12,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
objects []string `help:"Kubernetes objects to show. Options are: [nodes, pods, deployments]."`
|
objects []string `help:"Kubernetes objects to show. Options are: [nodes, pods, deployments]."`
|
||||||
title string `help:"Override the title of widget."`
|
title string `help:"Override the title of widget."`
|
||||||
@ -24,7 +24,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig),
|
||||||
|
|
||||||
objects: utils.ToStrs(moduleConfig.UList("objects")),
|
objects: utils.ToStrs(moduleConfig.UList("objects")),
|
||||||
title: moduleConfig.UString("title"),
|
title: moduleConfig.UString("title"),
|
||||||
|
@ -25,7 +25,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
objects: settings.objects,
|
objects: settings.objects,
|
||||||
title: settings.title,
|
title: settings.title,
|
||||||
@ -58,7 +58,7 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting node data [white]\n", true })
|
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting node data [white]\n", true })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
content += fmt.Sprintf("[%s]Nodes[white]\n", widget.settings.common.Colors.Subheading)
|
content += fmt.Sprintf("[%s]Nodes[white]\n", widget.settings.Colors.Subheading)
|
||||||
for _, node := range nodeList {
|
for _, node := range nodeList {
|
||||||
content += fmt.Sprintf("%s\n", node)
|
content += fmt.Sprintf("%s\n", node)
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting deployment data [white]\n", true })
|
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting deployment data [white]\n", true })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
content += fmt.Sprintf("[%s]Deployments[white]\n", widget.settings.common.Colors.Subheading)
|
content += fmt.Sprintf("[%s]Deployments[white]\n", widget.settings.Colors.Subheading)
|
||||||
for _, deployment := range deploymentList {
|
for _, deployment := range deploymentList {
|
||||||
content += fmt.Sprintf("%s\n", deployment)
|
content += fmt.Sprintf("%s\n", deployment)
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting pod data [white]\n", false })
|
widget.Redraw(func() (string, string, bool) { return title, "[red] Error getting pod data [white]\n", false })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
content += fmt.Sprintf("[%s]Pods[white]\n", widget.settings.common.Colors.Subheading)
|
content += fmt.Sprintf("[%s]Pods[white]\n", widget.settings.Colors.Subheading)
|
||||||
for _, pod := range podList {
|
for _, pod := range podList {
|
||||||
content += fmt.Sprintf("%s\n", pod)
|
content += fmt.Sprintf("%s\n", pod)
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -24,7 +24,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: view.NewTextWidget(app, nil, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
filePath: log.LogFilePath(),
|
filePath: log.LogFilePath(),
|
||||||
|
@ -18,13 +18,13 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
|
|
||||||
title := fmt.Sprintf(
|
title := fmt.Sprintf(
|
||||||
"%s - %s[white]",
|
"%s - %s[white]",
|
||||||
widget.settings.common.Colors.TextTheme.Title,
|
widget.settings.Colors.TextTheme.Title,
|
||||||
repoData.Repository,
|
repoData.Repository,
|
||||||
)
|
)
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n"
|
str := widget.settings.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Branch:Bookmark[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Branch:Bookmark[white]\n", widget.settings.Colors.Subheading)
|
||||||
str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
str += widget.formatChanges(repoData.ChangedFiles)
|
str += widget.formatChanges(repoData.ChangedFiles)
|
||||||
@ -35,7 +35,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatChanges(data []string) string {
|
func (widget *Widget) formatChanges(data []string) string {
|
||||||
str := fmt.Sprintf(" [%s]Changed Files[white]\n", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [%s]Changed Files[white]\n", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
if len(data) == 1 {
|
if len(data) == 1 {
|
||||||
str += " [grey]none[white]\n"
|
str += " [grey]none[white]\n"
|
||||||
@ -72,7 +72,7 @@ func (widget *Widget) formatChange(line string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatCommits(data []string) string {
|
func (widget *Widget) formatCommits(data []string) string {
|
||||||
str := fmt.Sprintf(" [%s]Recent Commits[white]\n", widget.settings.common.Colors.Subheading)
|
str := fmt.Sprintf(" [%s]Recent Commits[white]\n", widget.settings.Colors.Subheading)
|
||||||
|
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str += widget.formatCommit(line)
|
str += widget.formatCommit(line)
|
||||||
|
@ -11,7 +11,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
commitCount int `help:"The number of past commits to display." optional:"true"`
|
commitCount int `help:"The number of past commits to display." optional:"true"`
|
||||||
commitFormat string `help:"The string format for the commit message." optional:"true"`
|
commitFormat string `help:"The string format for the commit message." optional:"true"`
|
||||||
@ -21,7 +21,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
commitCount: ymlConfig.UInt("commitCount", 10),
|
commitCount: ymlConfig.UInt("commitCount", 10),
|
||||||
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
|
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
|
||||||
|
@ -27,8 +27,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
|
@ -11,12 +11,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -26,7 +26,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
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{
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func (widget *Widget) nbascore() (string, string, bool) {
|
|||||||
return title, err.Error(), true
|
return title, err.Error(), true
|
||||||
}
|
}
|
||||||
|
|
||||||
allGame := fmt.Sprintf(" [%s]", widget.settings.common.Colors.Subheading) + (cur.Format(utils.FriendlyDateFormat) + "\n\n") + "[white]"
|
allGame := fmt.Sprintf(" [%s]", widget.settings.Colors.Subheading) + (cur.Format(utils.FriendlyDateFormat) + "\n\n") + "[white]"
|
||||||
|
|
||||||
for _, game := range result["games"].([]interface{}) {
|
for _, game := range result["games"].([]interface{}) {
|
||||||
vTeam, hTeam, vScore, hScore := "", "", "", ""
|
vTeam, hTeam, vScore, hScore := "", "", "", ""
|
||||||
|
@ -39,7 +39,7 @@ func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string {
|
|||||||
" %s\n",
|
" %s\n",
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"[%s]Latest Deploys[white]",
|
"[%s]Latest Deploys[white]",
|
||||||
widget.settings.common.Colors.Subheading,
|
widget.settings.Colors.Subheading,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your New Relic API token."`
|
apiKey string `help:"Your New Relic API token."`
|
||||||
deployCount int `help:"The number of past deploys to display on screen." optional:"true"`
|
deployCount int `help:"The number of past deploys to display on screen." optional:"true"`
|
||||||
@ -23,7 +23,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
|
||||||
deployCount: ymlConfig.UInt("deployCount", 5),
|
deployCount: ymlConfig.UInt("deployCount", 5),
|
||||||
|
@ -19,8 +19,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{
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "applicationID", "applicationIDs"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "applicationID", "applicationIDs"),
|
||||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
*cfg.Common
|
||||||
|
|
||||||
apiKey string `help:"Your OpsGenie API token."`
|
apiKey string `help:"Your OpsGenie API token."`
|
||||||
region string `help:"Defines region to use. Possible options: us (by default), eu." optional:"true"`
|
region string `help:"Defines region to use. Possible options: us (by default), eu." optional:"true"`
|
||||||
@ -25,7 +25,7 @@ type Settings struct {
|
|||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_OPS_GENIE_API_KEY"))),
|
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_OPS_GENIE_API_KEY"))),
|
||||||
region: ymlConfig.UString("region", "us"),
|
region: ymlConfig.UString("region", "us"),
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user