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

A lot of code cleanup for Clocks and Git

This commit is contained in:
Chris Cummer
2018-04-18 16:45:50 -07:00
parent 1c72c71e81
commit 5e186323e0
7 changed files with 121 additions and 88 deletions

22
github/display.go Normal file
View File

@@ -0,0 +1,22 @@
package github
import (
"fmt"
)
func (widget *Widget) display() {
client := NewClient()
prs, _ := client.PullRequests(Config.UString("wtf.mods.github.owner"), Config.UString("wtf.mods.github.repo"))
widget.View.Clear()
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title()))
str := " [red]Open Review Requests[white]\n"
str = str + widget.prsForReview(prs, Config.UString("wtf.mods.github.username"))
str = str + "\n"
str = str + " [red]Open Pull Requests[white]\n"
str = str + widget.openPRs(prs, Config.UString("wtf.mods.github.username"))
fmt.Fprintf(widget.View, str)
}

17
github/github_repo.go Normal file
View File

@@ -0,0 +1,17 @@
package github
import ()
type GithubRepo struct {
Name string
Owner string
}
func NewGithubRepo(owner string, name string) *GithubRepo {
repo := GithubRepo{
Name: name,
Owner: owner,
}
return &repo
}

View File

@@ -31,20 +31,7 @@ func (widget *Widget) Refresh() {
return
}
client := NewClient()
prs, _ := client.PullRequests(Config.UString("wtf.mods.github.owner"), Config.UString("wtf.mods.github.repo"))
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title()))
str := " [red]Open Review Requests[white]\n"
str = str + widget.prsForReview(prs, Config.UString("wtf.mods.github.username"))
str = str + "\n"
str = str + " [red]Open Pull Requests[white]\n"
str = str + widget.openPRs(prs, Config.UString("wtf.mods.github.username"))
widget.View.Clear()
fmt.Fprintf(widget.View, str)
widget.display()
widget.RefreshedAt = time.Now()
}