Skip to content

Commit

Permalink
feat(pr): add column showing the diff shortstat
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Jul 12, 2024
1 parent 3f7ec21 commit 26c1d50
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions gh-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,14 @@ $global_binds
pr_cmd() {
# GO TEMPLATE {{{2
pr_template='\
--json "number,title,state,headRefName,milestone,updatedAt,labels" \
--json "number,title,state,headRefName,milestone,updatedAt,labels,additions,deletions,changedFiles" \
--template '\''
{{- $headerColor := "blue+b" -}}
{{- tablerow
("PR" | autocolor $headerColor)
("LAST UPDATE" | autocolor $headerColor)
("TITLE" | autocolor $headerColor)
("DIFF STAT" | autocolor $headerColor)
("BRANCH" | autocolor $headerColor)
("LABELS" | autocolor $headerColor)
("MILESTONE" | autocolor $headerColor)
Expand All @@ -271,10 +272,15 @@ pr_cmd() {
{{- tablerow
(printf "#%v" .number | autocolor $stateColor)
((timeago .updatedAt) | autocolor "white+d")
(truncate 100 (.title | autocolor "white+h"))
(truncate 60 (.headRefName | autocolor "white+d"))
(pluck "name" .labels | join ", " | autocolor "white+h")
($milestoneTitle | autocolor "white+d")
(truncate 90 (.title | autocolor "white+h"))
(printf "%s %s %s"
(printf "+%v" .additions | autocolor "green+d")
(printf "-%v" .deletions | autocolor "red+d")
(printf "(%v files)" .changedFiles | autocolor "white+d")
)
(truncate 60 (.headRefName | autocolor "white+h"))
(pluck "name" .labels | join ", " | autocolor "white+d")
($milestoneTitle | autocolor "white+h")
-}}
{{- end -}}
'\'''
Expand Down

0 comments on commit 26c1d50

Please sign in to comment.