Add additions and deletions in pr view

This commit is contained in:
Gowtham Munukutla 2021-03-05 11:20:49 +05:30
parent 2fbc037658
commit 9944698665
2 changed files with 10 additions and 1 deletions

View file

@ -39,6 +39,8 @@ type PullRequest struct {
HeadRefName string
Body string
Mergeable string
Additions int
Deletions int
MergeStateStatus string
Author struct {
@ -571,6 +573,8 @@ func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*Pu
closed
body
mergeable
additions
deletions
author {
login
}

View file

@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"sort"
"strconv"
"strings"
"sync"
@ -151,12 +152,16 @@ func printHumanPrPreview(opts *ViewOptions, pr *api.PullRequest) error {
// Header (Title and State)
fmt.Fprintln(out, cs.Bold(pr.Title))
fmt.Fprintf(out,
"%s • %s wants to merge %s into %s from %s\n",
"%s • %s wants to merge %s into %s from %s • %s%s %s%s \n",
shared.StateTitleWithColor(cs, *pr),
pr.Author.Login,
utils.Pluralize(pr.Commits.TotalCount, "commit"),
pr.BaseRefName,
pr.HeadRefName,
cs.Green("+"),
cs.Green(strconv.Itoa(pr.Additions)),
cs.Red("-"),
cs.Red(strconv.Itoa(pr.Deletions)),
)
// Reactions