mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into master
This commit is contained in:
commit
1523ef6245
14
.github/ISSUE_TEMPLATE/Bug.md
vendored
14
.github/ISSUE_TEMPLATE/Bug.md
vendored
@ -3,18 +3,8 @@ name: Bug Report
|
|||||||
about: Something is broken?
|
about: Something is broken?
|
||||||
---
|
---
|
||||||
|
|
||||||
### Bug Report
|
#### What's the problem?
|
||||||
|
|
||||||
#### Summary
|
|
||||||
<!-- Provide a summary desciribing the problem you are experiencing. -->
|
|
||||||
|
|
||||||
##### What is the current behaviour?
|
#### How did you expect it to behave?
|
||||||
<!-- wtf crashes-->
|
|
||||||
|
|
||||||
### How to reproduce
|
|
||||||
|
|
||||||
##### If the current behaviour is a bug, please provide the steps to reproduce it.
|
|
||||||
<!-- A great way to do this is to provide screenshots and commands.* -->
|
|
||||||
|
|
||||||
##### What do you think the expected behaviour should be?
|
|
||||||
<!--What do you think should happen?-->
|
|
||||||
|
13
.github/ISSUE_TEMPLATE/Feature.md
vendored
13
.github/ISSUE_TEMPLATE/Feature.md
vendored
@ -3,14 +3,9 @@ name: Feature Request
|
|||||||
about: You have a neat idea that should be implemented?
|
about: You have a neat idea that should be implemented?
|
||||||
---
|
---
|
||||||
|
|
||||||
### Feature Request
|
#### What problem does this solve?
|
||||||
<!-- Fill in the relevant information below to help triage your issue. -->
|
|
||||||
|
|
||||||
|
#### How do envision it working?
|
||||||
|
|
||||||
| Q | A
|
|
||||||
|------------ | ------
|
|
||||||
| New Feature | yes
|
|
||||||
| RFC | yes/no
|
|
||||||
| BC Break | yes/no
|
|
||||||
|
|
||||||
#### Summary
|
|
||||||
<!-- Provide a summary of the feature you would like to see implemented. -->
|
|
||||||
|
7
.github/ISSUE_TEMPLATE/Support.md
vendored
7
.github/ISSUE_TEMPLATE/Support.md
vendored
@ -3,9 +3,6 @@ name: ❓ Support Question
|
|||||||
about: Have a problem that you can't figure out?
|
about: Have a problem that you can't figure out?
|
||||||
---
|
---
|
||||||
|
|
||||||
| Q | A
|
#### What problem are you having and how can we help?
|
||||||
|------------ | -----
|
|
||||||
| Version | 0.0.4
|
|
||||||
#### Support Question
|
|
||||||
<!-- Describe the issue you are facing here. -->
|
|
||||||
|
|
||||||
|
13
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
13
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
@ -3,14 +3,9 @@ name: Improvement
|
|||||||
about: You have some improvement to make wtf better?
|
about: You have some improvement to make wtf better?
|
||||||
---
|
---
|
||||||
|
|
||||||
### Improvement
|
#### What problem does this solve?
|
||||||
<!-- Fill in the relevant information below to help triage your issue. -->
|
|
||||||
|
|
||||||
|
#### Is this related to an existing Issue? If so, which one?
|
||||||
|
|
||||||
| Q | A
|
|
||||||
|------------ | ------
|
|
||||||
| New Feature | yes
|
|
||||||
| RFC | yes/no
|
|
||||||
| BC Break | yes/no
|
|
||||||
|
|
||||||
#### Summary
|
|
||||||
<!-- Provide a summary of the improvement you are submitting. -->
|
|
||||||
|
11
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
11
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
@ -1,18 +1,11 @@
|
|||||||
---
|
---
|
||||||
name: Other
|
name: Other
|
||||||
about: You have some other ideas you want to introduce?
|
about: You have some other ideas you want to introduce?
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->
|
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->
|
||||||
|
|
||||||
**What kind of change does this PR introduce?**
|
#### What problem does this solve?
|
||||||
<!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->
|
|
||||||
|
|
||||||
**Summary**
|
|
||||||
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
|
|
||||||
<!-- Try to link to an open issue for more information. -->
|
|
||||||
|
|
||||||
**Does this PR introduce a breaking change?**
|
|
||||||
<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->
|
|
||||||
|
|
||||||
**Other information**
|
|
||||||
|
@ -25,10 +25,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
client := NewClient("https://api.bamboohr.com/api/gateway.php")
|
client := NewClient("https://api.bamboohr.com/api/gateway.php")
|
||||||
todayItems := client.Away(
|
todayItems := client.Away(
|
||||||
"timeOff",
|
"timeOff",
|
||||||
|
@ -29,10 +29,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.display(widget.clockColl.Sorted())
|
widget.display(widget.clockColl.Sorted())
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,6 @@ func NewWidget() *Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.execute()
|
widget.execute()
|
||||||
widget.View.SetTitle(fmt.Sprintf(" %s ", widget))
|
widget.View.SetTitle(fmt.Sprintf(" %s ", widget))
|
||||||
|
@ -100,10 +100,6 @@ func makeMarketCurrency(name string) *mCurrency {
|
|||||||
|
|
||||||
// Refresh & update after interval time
|
// Refresh & update after interval time
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.updateSummary()
|
widget.updateSummary()
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.display()
|
widget.display()
|
||||||
|
@ -38,10 +38,6 @@ func NewWidget() *Widget {
|
|||||||
|
|
||||||
// Refresh & update after interval time
|
// Refresh & update after interval time
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.updateCurrencies()
|
widget.updateCurrencies()
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
|
||||||
|
@ -29,10 +29,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
events, _ := Fetch()
|
events, _ := Fetch()
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
@ -49,10 +49,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
repoPaths := wtf.ToStrs(Config.UList("wtf.mods.git.repositories"))
|
repoPaths := wtf.ToStrs(Config.UList("wtf.mods.git.repositories"))
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
@ -51,10 +51,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, repo := range widget.GithubRepos {
|
for _, repo := range widget.GithubRepos {
|
||||||
repo.Refresh()
|
repo.Refresh()
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,6 @@ func NewWidget() *Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.ipinfo()
|
widget.ipinfo()
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
@ -73,10 +69,7 @@ func (widget *Widget) ipinfo() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
if err != nil {
|
|
||||||
widget.result = fmt.Sprintf("%s", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var info ipinfo
|
var info ipinfo
|
||||||
err = json.NewDecoder(response.Body).Decode(&info)
|
err = json.NewDecoder(response.Body).Decode(&info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -25,10 +25,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"), Config.UString("wtf.mods.jira.project", ""), Config.UString("wtf.mods.jira.jql", ""))
|
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"), Config.UString("wtf.mods.jira.project", ""), Config.UString("wtf.mods.jira.jql", ""))
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
@ -26,10 +26,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
app, appErr := Application()
|
app, appErr := Application()
|
||||||
deploys, depErr := Deployments()
|
deploys, depErr := Deployments()
|
||||||
|
|
||||||
|
@ -26,10 +26,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := Fetch()
|
data, err := Fetch()
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
@ -28,10 +28,6 @@ func NewWidget() *Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.Battery.Refresh()
|
widget.Battery.Refresh()
|
||||||
|
|
||||||
|
@ -30,10 +30,6 @@ func NewWidget() *Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.prettyWeather()
|
widget.prettyWeather()
|
||||||
|
|
||||||
|
@ -26,10 +26,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data := NewSecurityData()
|
data := NewSecurityData()
|
||||||
data.Fetch()
|
data.Fetch()
|
||||||
|
|
||||||
|
@ -28,10 +28,6 @@ func NewWidget() *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
|
||||||
widget.View.SetText(
|
widget.View.SetText(
|
||||||
|
@ -33,10 +33,6 @@ func NewWidget(date, version string) *Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
|
||||||
widget.View.SetText(
|
widget.View.SetText(
|
||||||
|
@ -48,10 +48,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath))
|
widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath))
|
||||||
|
|
||||||
|
@ -61,10 +61,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
|||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.load()
|
widget.load()
|
||||||
widget.display()
|
widget.display()
|
||||||
|
@ -74,10 +74,6 @@ func (widget *Widget) Fetch(cityIDs []int) []*owm.CurrentWeatherData {
|
|||||||
// Refresh fetches new data from the OpenWeatherMap API and loads the new data into the.
|
// Refresh fetches new data from the OpenWeatherMap API and loads the new data into the.
|
||||||
// widget's view for rendering
|
// widget's view for rendering
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
if widget.Disabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.Data = widget.Fetch(wtf.ToInts(Config.UList("wtf.mods.weather.cityids", widget.defaultCityCodes())))
|
widget.Data = widget.Fetch(wtf.ToInts(Config.UList("wtf.mods.weather.cityids", widget.defaultCityCodes())))
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
|
10
wtf.go
10
wtf.go
@ -122,6 +122,8 @@ func watchForConfigChanges(app *tview.Application, configFlag string, grid *tvie
|
|||||||
select {
|
select {
|
||||||
case <-watch.Event:
|
case <-watch.Event:
|
||||||
loadConfig(configFlag)
|
loadConfig(configFlag)
|
||||||
|
// Disable all widgets to stop scheduler goroutines and rmeove widgets from memory.
|
||||||
|
disableAllWidgets()
|
||||||
makeWidgets(app, pages)
|
makeWidgets(app, pages)
|
||||||
grid = buildGrid(Widgets)
|
grid = buildGrid(Widgets)
|
||||||
pages.AddPage("grid", grid, true, true)
|
pages.AddPage("grid", grid, true, true)
|
||||||
@ -156,6 +158,12 @@ var (
|
|||||||
version = "dev"
|
version = "dev"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func disableAllWidgets() {
|
||||||
|
for _, widget := range Widgets {
|
||||||
|
widget.Disable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func addWidget(app *tview.Application, pages *tview.Pages, widgetName string) {
|
func addWidget(app *tview.Application, pages *tview.Pages, widgetName string) {
|
||||||
// Always in alphabetical order
|
// Always in alphabetical order
|
||||||
switch widgetName {
|
switch widgetName {
|
||||||
@ -288,4 +296,6 @@ func main() {
|
|||||||
fmt.Printf("An error occurred: %v\n", err)
|
fmt.Printf("An error occurred: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wtf.Log("running!")
|
||||||
}
|
}
|
||||||
|
@ -3,4 +3,5 @@ package wtf
|
|||||||
type Enabler interface {
|
type Enabler interface {
|
||||||
Disabled() bool
|
Disabled() bool
|
||||||
Enabled() bool
|
Enabled() bool
|
||||||
|
Disable()
|
||||||
}
|
}
|
||||||
|
26
wtf/log.go
Normal file
26
wtf/log.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package wtf
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
//Log basic message logging, defaults to ~/.wtf/log.txt
|
||||||
|
func Log(message string) {
|
||||||
|
|
||||||
|
dir, err := Home()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
logfile := filepath.Join(dir, ".wtf", "log.txt")
|
||||||
|
f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("error opening file: %v", err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
log.SetOutput(f)
|
||||||
|
log.Println(message)
|
||||||
|
}
|
@ -61,6 +61,10 @@ func (widget *TextWidget) Enabled() bool {
|
|||||||
return widget.enabled
|
return widget.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (widget *TextWidget) Disable() {
|
||||||
|
widget.enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
func (widget *TextWidget) Focusable() bool {
|
func (widget *TextWidget) Focusable() bool {
|
||||||
return widget.enabled && widget.focusable
|
return widget.enabled && widget.focusable
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user