mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
more generics
This commit is contained in:
parent
eda8f4a5d4
commit
bf4f06ab4e
21 changed files with 303 additions and 198 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/jesseduffield/generics/maps"
|
||||
"github.com/jesseduffield/generics/slices"
|
||||
"github.com/jesseduffield/lazygit/pkg/app"
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
|
@ -174,11 +175,12 @@ outer:
|
|||
bindings []*types.Binding
|
||||
}
|
||||
|
||||
groupedBindings := make([]groupedBindingsType, 0, len(contextAndViewBindingMap))
|
||||
|
||||
for contextAndView, contextBindings := range contextAndViewBindingMap {
|
||||
groupedBindings = append(groupedBindings, groupedBindingsType{contextAndView: contextAndView, bindings: contextBindings})
|
||||
}
|
||||
groupedBindings := maps.MapToSlice(
|
||||
contextAndViewBindingMap,
|
||||
func(contextAndView contextAndViewType, contextBindings []*types.Binding) groupedBindingsType {
|
||||
return groupedBindingsType{contextAndView: contextAndView, bindings: contextBindings}
|
||||
},
|
||||
)
|
||||
|
||||
slices.SortFunc(groupedBindings, func(a, b groupedBindingsType) bool {
|
||||
first := a.contextAndView
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue