mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 00:26:24 -04:00
move pr color logic to own method
This commit is contained in:
parent
4a1fa4889d
commit
aed7c29509
|
|
@ -55,18 +55,7 @@ func getBranchDisplayStrings(
|
|||
res := []string{recencyColor.Sprint(b.Recency), coloredName}
|
||||
if showGithub {
|
||||
pr, hasPr := prs[b]
|
||||
if hasPr {
|
||||
colour := style.FgMagenta // = state MERGED
|
||||
switch pr.State {
|
||||
case "OPEN":
|
||||
colour = style.FgGreen
|
||||
case "CLOSED":
|
||||
colour = style.FgRed
|
||||
}
|
||||
res = append(res, colour.Sprint("#"+strconv.Itoa(pr.Number)))
|
||||
} else {
|
||||
res = append(res, "")
|
||||
}
|
||||
res = append(res, coloredPrNumber(pr, hasPr))
|
||||
}
|
||||
|
||||
if fullDescription {
|
||||
|
|
@ -105,3 +94,18 @@ func ColoredBranchStatus(branch *models.Branch) string {
|
|||
func BranchStatus(branch *models.Branch) string {
|
||||
return fmt.Sprintf("↑%s↓%s", branch.Pushables, branch.Pullables)
|
||||
}
|
||||
|
||||
func coloredPrNumber(pr *models.GithubPullRequest, hasPr bool) string {
|
||||
if hasPr {
|
||||
colour := style.FgMagenta // = state MERGED
|
||||
switch pr.State {
|
||||
case "OPEN":
|
||||
colour = style.FgGreen
|
||||
case "CLOSED":
|
||||
colour = style.FgRed
|
||||
}
|
||||
return colour.Sprint("#" + strconv.Itoa(pr.Number))
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue