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:
22
github/display.go
Normal file
22
github/display.go
Normal 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
17
github/github_repo.go
Normal 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
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user