2020-02-25 11:55:36 +02:00
|
|
|
package presentation
|
|
|
|
|
|
|
|
import (
|
2020-03-27 13:53:50 +02:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/fatih/color"
|
2020-02-25 11:55:36 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands"
|
2020-03-27 13:53:50 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
2020-02-25 11:55:36 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetRemoteListDisplayStrings(remotes []*commands.Remote) [][]string {
|
|
|
|
lines := make([][]string, len(remotes))
|
|
|
|
|
|
|
|
for i := range remotes {
|
|
|
|
lines[i] = getRemoteDisplayStrings(remotes[i])
|
|
|
|
}
|
|
|
|
|
|
|
|
return lines
|
|
|
|
}
|
|
|
|
|
|
|
|
// getRemoteDisplayStrings returns the display string of branch
|
|
|
|
func getRemoteDisplayStrings(r *commands.Remote) []string {
|
2020-03-27 13:53:50 +02:00
|
|
|
branchCount := len(r.Branches)
|
|
|
|
|
|
|
|
return []string{r.Name, utils.ColoredString(fmt.Sprintf("%d branches", branchCount), color.FgBlue)}
|
2020-02-25 11:55:36 +02:00
|
|
|
}
|