diff --git a/git/widget.go b/git/widget.go index 2ec815d8..def035ce 100644 --- a/git/widget.go +++ b/git/widget.go @@ -40,7 +40,7 @@ func (widget *Widget) Refresh() { 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.View.Clear() diff --git a/github/client.go b/github/client.go index 8fa086cd..3de4d51b 100644 --- a/github/client.go +++ b/github/client.go @@ -2,7 +2,7 @@ package github import ( "context" - "fmt" + //"fmt" "net/http" "os" @@ -22,7 +22,7 @@ func NewClient() *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() 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) if err != nil { - fmt.Printf("Problem in getting pull request information %v\n", err) - os.Exit(1) + return nil, err + //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() github := ghb.NewClient(oauthClient) repo, _, err := github.Repositories.Get(context.Background(), orgName, repoName) if err != nil { - fmt.Printf("Problem in getting repository information %v\n", err) - os.Exit(1) + return nil, err + //fmt.Printf("Problem in getting repository information %v\n", err) + //os.Exit(1) } - return repo + return repo, nil } /* -------------------- Unexported Functions -------------------- */ diff --git a/github/widget.go b/github/widget.go index c8b3b897..a27eb9d0 100644 --- a/github/widget.go +++ b/github/widget.go @@ -36,13 +36,15 @@ func NewWidget() *Widget { func (widget *Widget) Refresh() { 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 - 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) - widget.View.SetTitle(fmt.Sprintf(" 🤘 %s ", title)) + widget.View.SetTitle(fmt.Sprintf(" Github: %s ", title)) widget.RefreshedAt = time.Now() str := "\n"