1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

31 lines
828 B
Go

package presentation
import (
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/theme"
)
func GetRemoteListDisplayStrings(remotes []*models.Remote, diffName string) [][]string {
lines := make([][]string, len(remotes))
for i := range remotes {
diffed := remotes[i].Name == diffName
lines[i] = getRemoteDisplayStrings(remotes[i], diffed)
}
return lines
}
// getRemoteDisplayStrings returns the display string of branch
func getRemoteDisplayStrings(r *models.Remote, diffed bool) []string {
branchCount := len(r.Branches)
nameColorAttr := theme.DefaultTextColor
if diffed {
nameColorAttr = theme.DiffTerminalColor
}
return []string{nameColorAttr.Sprint(r.Name), style.FgBlue.Sprintf("%d branches", branchCount)}
}