X Tutup
Skip to content

Commit 9944698

Browse files
committed
Add additions and deletions in pr view
1 parent 2fbc037 commit 9944698

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

api/queries_pr.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type PullRequest struct {
3939
HeadRefName string
4040
Body string
4141
Mergeable string
42+
Additions int
43+
Deletions int
4244
MergeStateStatus string
4345

4446
Author struct {
@@ -571,6 +573,8 @@ func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*Pu
571573
closed
572574
body
573575
mergeable
576+
additions
577+
deletions
574578
author {
575579
login
576580
}

pkg/cmd/pr/view/view.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"net/http"
77
"sort"
8+
"strconv"
89
"strings"
910
"sync"
1011

@@ -151,12 +152,16 @@ func printHumanPrPreview(opts *ViewOptions, pr *api.PullRequest) error {
151152
// Header (Title and State)
152153
fmt.Fprintln(out, cs.Bold(pr.Title))
153154
fmt.Fprintf(out,
154-
"%s • %s wants to merge %s into %s from %s\n",
155+
"%s • %s wants to merge %s into %s from %s • %s%s %s%s \n",
155156
shared.StateTitleWithColor(cs, *pr),
156157
pr.Author.Login,
157158
utils.Pluralize(pr.Commits.TotalCount, "commit"),
158159
pr.BaseRefName,
159160
pr.HeadRefName,
161+
cs.Green("+"),
162+
cs.Green(strconv.Itoa(pr.Additions)),
163+
cs.Red("-"),
164+
cs.Red(strconv.Itoa(pr.Deletions)),
160165
)
161166

162167
// Reactions

0 commit comments

Comments
 (0)
X Tutup