mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into add-hackernews-module
This commit is contained in:
commit
a40e03f085
@ -1,5 +1,5 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
checks:
|
checks:
|
||||||
similar-code:
|
similar-code:
|
||||||
config:
|
config:
|
||||||
threshold: 3
|
threshold: 3
|
||||||
|
4
Makefile
4
Makefile
@ -11,6 +11,10 @@ install:
|
|||||||
go install -ldflags="-s -w -X main.version=$(shell git describe --always --abbrev=6) -X main.date=$(shell date +%FT%T%z)"
|
go install -ldflags="-s -w -X main.version=$(shell git describe --always --abbrev=6) -X main.date=$(shell date +%FT%T%z)"
|
||||||
which wtf
|
which wtf
|
||||||
|
|
||||||
|
lint:
|
||||||
|
structcheck ./...
|
||||||
|
varcheck ./...
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
bin/wtf
|
bin/wtf
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (widget *Widget) display(clocks []Clock) {
|
func (widget *Widget) display(clocks []Clock) {
|
||||||
if len(clocks) == 0 {
|
if len(clocks) == 0 {
|
||||||
fmt.Fprintf(widget.View, "\n%s", " no timezone data available")
|
widget.View.SetText(fmt.Sprintf("\n%s", " no timezone data available"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
project := widget.currentGerritProject()
|
project := widget.currentGerritProject()
|
||||||
if project == nil {
|
if project == nil {
|
||||||
fmt.Fprintf(widget.View, "%s", " Gerrit project data is unavailable (1)")
|
widget.View.SetText(fmt.Sprintf("%s", " Gerrit project data is unavailable (1)"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,13 +32,8 @@ type Widget struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||||
apiKey := wtf.Config.UString(
|
|
||||||
"wtf.mods.gitlab.apiKey",
|
|
||||||
os.Getenv("WTF_GITLAB_TOKEN"),
|
|
||||||
)
|
|
||||||
|
|
||||||
baseURL := wtf.Config.UString("wtf.mods.gitlab.domain")
|
baseURL := wtf.Config.UString("wtf.mods.gitlab.domain")
|
||||||
gitlab := glb.NewClient(nil, apiKey)
|
gitlab := glb.NewClient(nil, apiKey())
|
||||||
|
|
||||||
if baseURL != "" {
|
if baseURL != "" {
|
||||||
gitlab.SetBaseURL(baseURL)
|
gitlab.SetBaseURL(baseURL)
|
||||||
@ -92,6 +87,13 @@ func (widget *Widget) Prev() {
|
|||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
|
func apiKey() string {
|
||||||
|
return wtf.Config.UString(
|
||||||
|
"wtf.mods.gitlab.apiKey",
|
||||||
|
os.Getenv("WTF_GITLAB_TOKEN"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func (widget *Widget) buildProjectCollection(projectData map[string]interface{}) []*GitlabProject {
|
func (widget *Widget) buildProjectCollection(projectData map[string]interface{}) []*GitlabProject {
|
||||||
gitlabProjects := []*GitlabProject{}
|
gitlabProjects := []*GitlabProject{}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ func Log(msg string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.OpenFile(logFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
f, err := os.OpenFile(logFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("error opening file: %v", err)
|
log.Fatalf("error opening file: %v", err)
|
||||||
}
|
}
|
||||||
|
5
main.go
5
main.go
@ -131,7 +131,10 @@ func refreshAllWidgets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setTerm() {
|
func setTerm() {
|
||||||
os.Setenv("TERM", Config.UString("wtf.term", os.Getenv("TERM")))
|
err := os.Setenv("TERM", Config.UString("wtf.term", os.Getenv("TERM")))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func watchForConfigChanges(app *tview.Application, configFilePath string, grid *tview.Grid, pages *tview.Pages) {
|
func watchForConfigChanges(app *tview.Application, configFilePath string, grid *tview.Grid, pages *tview.Pages) {
|
||||||
|
@ -13,8 +13,6 @@ import (
|
|||||||
"github.com/senorprogrammer/wtf/wtf"
|
"github.com/senorprogrammer/wtf/wtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APIEnvToken = "WTF_TRAVIS_API_TOKEN"
|
|
||||||
|
|
||||||
var TRAVIS_HOSTS = map[bool]string{
|
var TRAVIS_HOSTS = map[bool]string{
|
||||||
false: "travis-ci.org",
|
false: "travis-ci.org",
|
||||||
true: "travis-ci.com",
|
true: "travis-ci.com",
|
||||||
@ -75,7 +73,7 @@ func travisRequest(path string) (*http.Response, error) {
|
|||||||
func apiToken() string {
|
func apiToken() string {
|
||||||
return wtf.Config.UString(
|
return wtf.Config.UString(
|
||||||
"wtf.mods.travisci.apiKey",
|
"wtf.mods.travisci.apiKey",
|
||||||
os.Getenv(APIEnvToken),
|
os.Getenv("WTF_TRAVIS_API_TOKEN"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user