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

Fixing merge conflict

This commit is contained in:
Chris Cummer 2018-06-03 20:58:44 -07:00
commit 5ff80f309a
19 changed files with 31 additions and 30 deletions

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 👽 BambooHR ", "bamboohr", false), TextWidget: wtf.NewTextWidget(" BambooHR ", "bamboohr", false),
} }
return &widget return &widget
@ -37,7 +37,7 @@ func (widget *Widget) Refresh() {
) )
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf(" 👽 Away (%d) ", len(todayItems))) widget.View.SetTitle(fmt.Sprintf("%s(%d)", widget.Name, len(todayItems)))
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(todayItems))) widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(todayItems)))
} }

View File

@ -18,7 +18,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 🕗 World Clocks ", "clocks", false), TextWidget: wtf.NewTextWidget(" World Clocks ", "clocks", false),
} }
widget.clockColl = widget.buildClockCollection(Config.UMap("wtf.mods.clocks.locations")) widget.clockColl = widget.buildClockCollection(Config.UMap("wtf.mods.clocks.locations"))

View File

@ -22,7 +22,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 🏃 Runner ", "cmdrunner", false), TextWidget: wtf.NewTextWidget(" CmdRunner ", "cmdrunner", false),
args: wtf.ToStrs(Config.UList("wtf.mods.cmdrunner.args")), args: wtf.ToStrs(Config.UList("wtf.mods.cmdrunner.args")),
cmd: Config.UString("wtf.mods.cmdrunner.cmd"), cmd: Config.UString("wtf.mods.cmdrunner.cmd"),

View File

@ -3,9 +3,8 @@ package cryptolive
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"time"
"net/http" "net/http"
"time"
"github.com/olebedev/config" "github.com/olebedev/config"
"github.com/senorprogrammer/wtf/wtf" "github.com/senorprogrammer/wtf/wtf"
@ -32,7 +31,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
started = false started = false
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), TextWidget: wtf.NewTextWidget(" CryptoLive ", "cryptolive", false),
updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10), updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10),
} }

View File

@ -20,7 +20,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 🍿 Calendar ", "gcal", false), TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", false),
} }
return &widget return &widget

View File

@ -17,7 +17,7 @@ func (widget *Widget) display() {
} }
title := fmt.Sprintf("[green]%s[white]\n", repoData.Repository) title := fmt.Sprintf("[green]%s[white]\n", repoData.Repository)
widget.View.SetTitle(fmt.Sprintf(" Git: %s ", title)) widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, title))
str := wtf.SigilStr(len(widget.Data), widget.Idx, widget.View) + "\n" str := wtf.SigilStr(len(widget.Data), widget.Idx, widget.View) + "\n"
str = str + " [red]Branch[white]\n" str = str + " [red]Branch[white]\n"

View File

@ -14,7 +14,7 @@ func (widget *Widget) display() {
return return
} }
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title(repo))) widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, widget.title(repo)))
str := wtf.SigilStr(len(widget.GithubRepos), widget.Idx, widget.View) + "\n" str := wtf.SigilStr(len(widget.GithubRepos), widget.Idx, widget.View) + "\n"
str = str + " [red]Stats[white]\n" str = str + " [red]Stats[white]\n"

View File

@ -16,7 +16,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget("JIRA", "jira", false), TextWidget: wtf.NewTextWidget(" Jira ", "jira", false),
} }
return &widget return &widget
@ -35,13 +35,13 @@ func (widget *Widget) Refresh() {
if err != nil { if err != nil {
widget.View.SetWrap(true) widget.View.SetWrap(true)
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name)) widget.View.SetTitle(fmt.Sprintf("%s", widget.Name))
fmt.Fprintf(widget.View, "%v", err) fmt.Fprintf(widget.View, "%v", err)
} else { } else {
widget.View.SetWrap(false) widget.View.SetWrap(false)
widget.View.SetTitle( widget.View.SetTitle(
fmt.Sprintf( fmt.Sprintf(
" %s: [green]%s[white] ", "%s- [green]%s[white]",
widget.Name, widget.Name,
Config.UString("wtf.mods.jira.project"), Config.UString("wtf.mods.jira.project"),
), ),

View File

@ -39,7 +39,7 @@ func (widget *Widget) Refresh() {
} }
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf(" New Relic: [green]%s[white] ", appName)) widget.View.SetTitle(fmt.Sprintf("%s- [green]%s[white]", widget.Name, appName))
widget.View.Clear() widget.View.Clear()
if depErr != nil { if depErr != nil {

View File

@ -17,7 +17,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" OpsGenie ", "opsgenie", false), TextWidget: wtf.NewTextWidget(" OpsGenie ", "opsgenie", false),
} }
return &widget return &widget
@ -33,7 +33,7 @@ func (widget *Widget) Refresh() {
data, err := Fetch() data, err := Fetch()
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.View.SetTitle(" ⏰ On Call ") widget.View.SetTitle(widget.Name)
if err != nil { if err != nil {
widget.View.SetWrap(true) widget.View.SetWrap(true)

View File

@ -18,7 +18,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" ⚡️ Power ", "power", false), TextWidget: wtf.NewTextWidget(" Power ", "power", false),
Battery: NewBattery(), Battery: NewBattery(),
} }

View File

@ -22,7 +22,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget("Pretty Weather", "prettyweather", false), TextWidget: wtf.NewTextWidget(" Pretty Weather ", "prettyweather", false),
} }
return &widget return &widget
@ -35,7 +35,6 @@ func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.prettyWeather() widget.prettyWeather()
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
widget.View.SetText(fmt.Sprintf("%s", widget.result)) widget.View.SetText(fmt.Sprintf("%s", widget.result))
} }

View File

@ -17,7 +17,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 🤺 Security ", "security", false), TextWidget: wtf.NewTextWidget(" Security ", "security", false),
} }
return &widget return &widget

View File

@ -18,7 +18,7 @@ type Widget struct {
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 🎉 Status ", "status", false), TextWidget: wtf.NewTextWidget(" Status ", "status", false),
CurrentIcon: 0, CurrentIcon: 0,
} }

View File

@ -21,7 +21,7 @@ type Widget struct {
func NewWidget(date, version string) *Widget { func NewWidget(date, version string) *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" Build ", "system", false), TextWidget: wtf.NewTextWidget(" System ", "system", false),
Date: date, Date: date,
Version: version, Version: version,

View File

@ -30,7 +30,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 📄 Text File ", "textfile", true), TextWidget: wtf.NewTextWidget(" Text File ", "textfile", true),
app: app, app: app,
filePath: Config.UString("wtf.mods.textfile.filePath"), filePath: Config.UString("wtf.mods.textfile.filePath"),
@ -53,7 +53,7 @@ func (widget *Widget) Refresh() {
} }
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf(" 📄 %s ", widget.filePath)) widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath))
filePath, _ := wtf.ExpandHomeDir(widget.filePath) filePath, _ := wtf.ExpandHomeDir(widget.filePath)

View File

@ -44,7 +44,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" 📝 Todo ", "todo", true), TextWidget: wtf.NewTextWidget(" Todo ", "todo", true),
app: app, app: app,
filePath: Config.UString("wtf.mods.todo.filename"), filePath: Config.UString("wtf.mods.todo.filename"),

11
wtf.go
View File

@ -155,9 +155,12 @@ var (
) )
func makeWidgets(app *tview.Application, pages *tview.Pages) { func makeWidgets(app *tview.Application, pages *tview.Pages) {
// Always in alphabetical order
bamboohr.Config = Config bamboohr.Config = Config
clocks.Config = Config clocks.Config = Config
cmdrunner.Config = Config cmdrunner.Config = Config
wtf.Config = Config
cryptolive.Config = Config
gcal.Config = Config gcal.Config = Config
git.Config = Config git.Config = Config
github.Config = Config github.Config = Config
@ -166,20 +169,21 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) {
newrelic.Config = Config newrelic.Config = Config
opsgenie.Config = Config opsgenie.Config = Config
power.Config = Config power.Config = Config
prettyweather.Config = Config
security.Config = Config security.Config = Config
status.Config = Config status.Config = Config
system.Config = Config system.Config = Config
textfile.Config = Config textfile.Config = Config
todo.Config = Config todo.Config = Config
weather.Config = Config weather.Config = Config
prettyweather.Config = Config
wtf.Config = Config wtf.Config = Config
cryptolive.Config = Config
// Always in alphabetical order
Widgets = []wtf.Wtfable{ Widgets = []wtf.Wtfable{
bamboohr.NewWidget(), bamboohr.NewWidget(),
clocks.NewWidget(), clocks.NewWidget(),
cmdrunner.NewWidget(), cmdrunner.NewWidget(),
cryptolive.NewWidget(),
gcal.NewWidget(), gcal.NewWidget(),
git.NewWidget(app, pages), git.NewWidget(app, pages),
github.NewWidget(app, pages), github.NewWidget(app, pages),
@ -188,14 +192,13 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) {
newrelic.NewWidget(), newrelic.NewWidget(),
opsgenie.NewWidget(), opsgenie.NewWidget(),
power.NewWidget(), power.NewWidget(),
prettyweather.NewWidget(),
security.NewWidget(), security.NewWidget(),
status.NewWidget(), status.NewWidget(),
system.NewWidget(date, version), system.NewWidget(date, version),
textfile.NewWidget(app, pages), textfile.NewWidget(app, pages),
todo.NewWidget(app, pages), todo.NewWidget(app, pages),
weather.NewWidget(app, pages), weather.NewWidget(app, pages),
cryptolive.NewWidget(),
prettyweather.NewWidget(),
} }
FocusTracker = wtf.FocusTracker{ FocusTracker = wtf.FocusTracker{

View File

@ -27,7 +27,7 @@ func NewTextWidget(name string, configKey string, focusable bool) TextWidget {
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false), enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
focusable: focusable, focusable: focusable,
Name: name, Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name),
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)), RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
} }