1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

add actions abstraction

This commit is contained in:
Jesse Duffield
2022-01-30 10:17:55 +11:00
parent 51547e3822
commit 77d0732fa8
4 changed files with 100 additions and 77 deletions

View File

@ -581,15 +581,7 @@ func (gui *Gui) setControllers() {
gui.fileHelper = NewFileHelper(controllerCommon, gui.git, osCommand)
gui.workingTreeHelper = NewWorkingTreeHelper(func() *filetree.FileTreeViewModel { return gui.State.FileTreeViewModel })
tagsController := controllers.NewTagsController(
controllerCommon,
func() *context.TagsContext { return gui.State.Contexts.Tags },
gui.git,
getContexts,
refHelper,
gui.suggestionsHelper,
gui.switchToSubCommitsContext,
)
tagActions := controllers.NewTagActions(controllerCommon, gui.git)
syncController := controllers.NewSyncController(
controllerCommon,
@ -629,20 +621,28 @@ func (gui *Gui) setControllers() {
gui.fileHelper,
gui.workingTreeHelper,
),
Tags: tagsController,
Tags: controllers.NewTagsController(
controllerCommon,
func() *context.TagsContext { return gui.State.Contexts.Tags },
gui.git,
getContexts,
tagActions,
refHelper,
gui.suggestionsHelper,
gui.switchToSubCommitsContext,
),
LocalCommits: controllers.NewLocalCommitsController(
controllerCommon,
func() types.IListContext { return gui.State.Contexts.BranchCommits },
osCommand,
gui.git,
tagActions,
refHelper,
gui.getSelectedLocalCommit,
func() []*models.Commit { return gui.State.Commits },
func() int { return gui.State.Panels.Commits.SelectedLineIdx },
gui.checkMergeOrRebase,
syncController.HandlePull,
tagsController.CreateTagMenu,
gui.getHostingServiceMgr,
gui.SwitchToCommitFilesContext,
gui.handleOpenSearch,
@ -651,7 +651,6 @@ func (gui *Gui) setControllers() {
func() bool { return gui.ShowWholeGitGraph },
func(value bool) { gui.ShowWholeGitGraph = value },
),
Remotes: controllers.NewRemotesController(
controllerCommon,
func() types.IListContext { return gui.State.Contexts.Remotes },