mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Git title display improvements
This commit is contained in:
parent
fd5becd397
commit
59676ca344
@ -40,7 +40,7 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
title := fmt.Sprintf("[green]%s[white]\n", data["repo"][0])
|
title := fmt.Sprintf("[green]%s[white]\n", data["repo"][0])
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" 🤞 %s ", title))
|
widget.View.SetTitle(fmt.Sprintf(" Git: %s ", title))
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
|
@ -2,7 +2,7 @@ package github
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
//"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ func NewClient() *Client {
|
|||||||
return &client
|
return &client
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) PullRequests(orgName string, repoName string) []*ghb.PullRequest {
|
func (client *Client) PullRequests(orgName string, repoName string) ([]*ghb.PullRequest, error) {
|
||||||
oauthClient := client.oauthClient()
|
oauthClient := client.oauthClient()
|
||||||
github := ghb.NewClient(oauthClient)
|
github := ghb.NewClient(oauthClient)
|
||||||
|
|
||||||
@ -31,25 +31,27 @@ func (client *Client) PullRequests(orgName string, repoName string) []*ghb.PullR
|
|||||||
prs, _, err := github.PullRequests.List(context.Background(), orgName, repoName, opts)
|
prs, _, err := github.PullRequests.List(context.Background(), orgName, repoName, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Problem in getting pull request information %v\n", err)
|
return nil, err
|
||||||
os.Exit(1)
|
//fmt.Printf("Problem in getting pull request information %v\n", err)
|
||||||
|
//os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return prs
|
return prs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Repository(orgName string, repoName string) *ghb.Repository {
|
func (client *Client) Repository(orgName string, repoName string) (*ghb.Repository, error) {
|
||||||
oauthClient := client.oauthClient()
|
oauthClient := client.oauthClient()
|
||||||
github := ghb.NewClient(oauthClient)
|
github := ghb.NewClient(oauthClient)
|
||||||
|
|
||||||
repo, _, err := github.Repositories.Get(context.Background(), orgName, repoName)
|
repo, _, err := github.Repositories.Get(context.Background(), orgName, repoName)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Problem in getting repository information %v\n", err)
|
return nil, err
|
||||||
os.Exit(1)
|
//fmt.Printf("Problem in getting repository information %v\n", err)
|
||||||
|
//os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return repo
|
return repo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -36,13 +36,15 @@ func NewWidget() *Widget {
|
|||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
client := NewClient()
|
client := NewClient()
|
||||||
repo := client.Repository(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
|
||||||
|
repo, _ := client.Repository(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
||||||
org := *repo.Organization
|
org := *repo.Organization
|
||||||
prs := client.PullRequests(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
|
||||||
|
prs, _ := client.PullRequests(Config.UString("wtf.github.organization"), Config.UString("wtf.github.repo"))
|
||||||
|
|
||||||
title := fmt.Sprintf("[green]%s - %s[white]", *org.Login, *repo.Name)
|
title := fmt.Sprintf("[green]%s - %s[white]", *org.Login, *repo.Name)
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" 🤘 %s ", title))
|
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", title))
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
str := "\n"
|
str := "\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user