Use gray color for PR number if PR is a draft
This commit is contained in:
parent
7950023a87
commit
2a42f61d8d
2 changed files with 20 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ type PullRequest struct {
|
|||
}
|
||||
}
|
||||
IsCrossRepository bool
|
||||
IsDraft bool
|
||||
MaintainerCanModify bool
|
||||
|
||||
ReviewDecision string
|
||||
|
|
@ -156,6 +157,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
|
|||
login
|
||||
}
|
||||
isCrossRepository
|
||||
isDraft
|
||||
commits(last: 1) {
|
||||
nodes {
|
||||
commit {
|
||||
|
|
@ -366,6 +368,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, branch string)
|
|||
login
|
||||
}
|
||||
isCrossRepository
|
||||
isDraft
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -460,6 +463,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
|
|||
login
|
||||
}
|
||||
isCrossRepository
|
||||
isDraft
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
if table.IsTTY() {
|
||||
prNum = "#" + prNum
|
||||
}
|
||||
table.AddField(prNum, nil, colorFuncForState(pr.State))
|
||||
table.AddField(prNum, nil, colorFuncForPR(pr))
|
||||
table.AddField(replaceExcessiveWhitespace(pr.Title), nil, nil)
|
||||
table.AddField(pr.HeadLabel(), nil, utils.Cyan)
|
||||
table.EndRow()
|
||||
|
|
@ -227,6 +227,14 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func colorFuncForPR(pr api.PullRequest) func(string) string {
|
||||
if pr.State == "OPEN" && pr.IsDraft {
|
||||
return utils.Gray
|
||||
} else {
|
||||
return colorFuncForState(pr.State)
|
||||
}
|
||||
}
|
||||
|
||||
func colorFuncForState(state string) func(string) string {
|
||||
switch state {
|
||||
case "OPEN":
|
||||
|
|
@ -385,7 +393,13 @@ func prSelectorForCurrentBranch(ctx context.Context) (prNumber int, prHeadRef st
|
|||
func printPrs(w io.Writer, totalCount int, prs ...api.PullRequest) {
|
||||
for _, pr := range prs {
|
||||
prNumber := fmt.Sprintf("#%d", pr.Number)
|
||||
fmt.Fprintf(w, " %s %s %s", utils.Green(prNumber), text.Truncate(50, replaceExcessiveWhitespace(pr.Title)), utils.Cyan("["+pr.HeadLabel()+"]"))
|
||||
|
||||
prNumberColorFunc := utils.Green
|
||||
if pr.IsDraft {
|
||||
prNumberColorFunc = utils.Gray
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, " %s %s %s", prNumberColorFunc(prNumber), text.Truncate(50, replaceExcessiveWhitespace(pr.Title)), utils.Cyan("["+pr.HeadLabel()+"]"))
|
||||
|
||||
checks := pr.ChecksStatus()
|
||||
reviews := pr.ReviewStatus()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue