summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-03-19 15:36:46 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-24 20:14:41 +1100
commiteda8f4a5d4302691d99efd066f9851809c984bc0 (patch)
tree0cb13f767ca52682a62d09314f8d9f2f2c1cd4a1 /pkg/gui/controllers
parentc7a629c4401ae0d4aad06767c88ce1e9e418dbf3 (diff)
lots more generics
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r--pkg/gui/controllers/global_controller.go4
-rw-r--r--pkg/gui/controllers/helpers/cherry_pick_helper.go13
2 files changed, 9 insertions, 8 deletions
diff --git a/pkg/gui/controllers/global_controller.go b/pkg/gui/controllers/global_controller.go
index c45e98d85..e59231739 100644
--- a/pkg/gui/controllers/global_controller.go
+++ b/pkg/gui/controllers/global_controller.go
@@ -1,7 +1,7 @@
package controllers
import (
- "github.com/jesseduffield/generics/list"
+ "github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
@@ -57,7 +57,7 @@ func (self *GlobalController) customCommand() error {
func (self *GlobalController) GetCustomCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion {
// reversing so that we display the latest command first
- history := list.Reverse(self.c.GetAppState().CustomCommandsHistory)
+ history := slices.Reverse(self.c.GetAppState().CustomCommandsHistory)
return helpers.FuzzySearchFunc(history)
}
diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go
index e4a9b3e81..c433655d0 100644
--- a/pkg/gui/controllers/helpers/cherry_pick_helper.go
+++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go
@@ -2,6 +2,7 @@ package helpers
import (
"github.com/jesseduffield/generics/set"
+ "github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
@@ -118,12 +119,12 @@ func (self *CherryPickHelper) add(selectedCommit *models.Commit, commitsList []*
commitSet := self.CherryPickedCommitShaSet()
commitSet.Add(selectedCommit.Sha)
- commitsInSet := lo.Filter(commitsList, func(commit *models.Commit, _ int) bool {
- return commitSet.Includes(commit.Sha)
- })
- newCommits := lo.Map(commitsInSet, func(commit *models.Commit, _ int) *models.Commit {
- return &models.Commit{Name: commit.Name, Sha: commit.Sha}
- })
+ newCommits := slices.FilterThenMap(commitsList,
+ func(commit *models.Commit) bool { return commitSet.Includes(commit.Sha) },
+ func(commit *models.Commit) *models.Commit {
+ return &models.Commit{Name: commit.Name, Sha: commit.Sha}
+ },
+ )
self.getData().CherryPickedCommits = newCommits
}