1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

many more generics

This commit is contained in:
Jesse Duffield
2022-03-19 19:12:58 +11:00
parent bf4f06ab4e
commit 1b75ed3740
31 changed files with 278 additions and 320 deletions

View File

@ -1,20 +1,17 @@
package presentation
import (
"github.com/jesseduffield/generics/slices"
"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
return slices.Map(remotes, func(remote *models.Remote) []string {
diffed := remote.Name == diffName
return getRemoteDisplayStrings(remote, diffed)
})
}
// getRemoteDisplayStrings returns the display string of branch