diff options
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r-- | pkg/gui/controllers/files_controller.go | 18 | ||||
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 18 | ||||
-rw-r--r-- | pkg/gui/controllers/tags_controller.go | 18 | ||||
-rw-r--r-- | pkg/gui/controllers/tags_helper.go (renamed from pkg/gui/controllers/tag_actions.go) | 16 | ||||
-rw-r--r-- | pkg/gui/controllers/types.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/undo_controller.go | 12 |
6 files changed, 42 insertions, 42 deletions
diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index e2626078d..8ce768ac6 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -39,8 +39,8 @@ type FilesController struct { getSelectedPath func() string switchToMergeFn func(path string) error suggestionsHelper ISuggestionsHelper - refHelper IRefHelper - fileHelper IFileHelper + refsHelper IRefsHelper + filesHelper IFileHelper workingTreeHelper IWorkingTreeHelper } @@ -63,8 +63,8 @@ func NewFilesController( getSelectedPath func() string, switchToMergeFn func(path string) error, suggestionsHelper ISuggestionsHelper, - refHelper IRefHelper, - fileHelper IFileHelper, + refsHelper IRefsHelper, + filesHelper IFileHelper, workingTreeHelper IWorkingTreeHelper, ) *FilesController { return &FilesController{ @@ -84,8 +84,8 @@ func NewFilesController( getSelectedPath: getSelectedPath, switchToMergeFn: switchToMergeFn, suggestionsHelper: suggestionsHelper, - refHelper: refHelper, - fileHelper: fileHelper, + refsHelper: refsHelper, + filesHelper: filesHelper, workingTreeHelper: workingTreeHelper, } } @@ -554,7 +554,7 @@ func (self *FilesController) edit(node *filetree.FileNode) error { return self.c.ErrorMsg(self.c.Tr.ErrCannotEditDirectory) } - return self.fileHelper.EditFile(node.GetPath()) + return self.filesHelper.EditFile(node.GetPath()) } func (self *FilesController) Open() error { @@ -563,7 +563,7 @@ func (self *FilesController) Open() error { return nil } - return self.fileHelper.OpenFile(node.GetPath()) + return self.filesHelper.OpenFile(node.GetPath()) } func (self *FilesController) switchToMerge() error { @@ -627,7 +627,7 @@ func (self *FilesController) stash() error { } func (self *FilesController) createResetMenu() error { - return self.refHelper.CreateGitResetMenu("@{upstream}") + return self.refsHelper.CreateGitResetMenu("@{upstream}") } func (self *FilesController) handleToggleDirCollapsed() error { diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 3222a37e3..8b4cddfaf 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -28,8 +28,8 @@ type LocalCommitsController struct { getContext func() types.IListContext os *oscommands.OSCommand git *commands.GitCommand - tagActions *TagActions - refHelper IRefHelper + tagsHelper *TagsHelper + refsHelper IRefsHelper getSelectedLocalCommit func() *models.Commit getCommits func() []*models.Commit @@ -52,8 +52,8 @@ func NewLocalCommitsController( getContext func() types.IListContext, os *oscommands.OSCommand, git *commands.GitCommand, - tagActions *TagActions, - refHelper IRefHelper, + tagsHelper *TagsHelper, + refsHelper IRefsHelper, getSelectedLocalCommit func() *models.Commit, getCommits func() []*models.Commit, getSelectedLocalCommitIdx func() int, @@ -72,8 +72,8 @@ func NewLocalCommitsController( getContext: getContext, os: os, git: git, - tagActions: tagActions, - refHelper: refHelper, + tagsHelper: tagsHelper, + refsHelper: refsHelper, getSelectedLocalCommit: getSelectedLocalCommit, getCommits: getCommits, getSelectedLocalCommitIdx: getSelectedLocalCommitIdx, @@ -606,7 +606,7 @@ func (self *LocalCommitsController) handleSquashAllAboveFixupCommits(commit *mod } func (self *LocalCommitsController) handleTagCommit(commit *models.Commit) error { - return self.tagActions.CreateTagMenu(commit.Sha, func() {}) + return self.tagsHelper.CreateTagMenu(commit.Sha, func() {}) } func (self *LocalCommitsController) handleCheckoutCommit(commit *models.Commit) error { @@ -615,13 +615,13 @@ func (self *LocalCommitsController) handleCheckoutCommit(commit *models.Commit) Prompt: self.c.Tr.SureCheckoutThisCommit, HandleConfirm: func() error { self.c.LogAction(self.c.Tr.Actions.CheckoutCommit) - return self.refHelper.CheckoutRef(commit.Sha, types.CheckoutRefOptions{}) + return self.refsHelper.CheckoutRef(commit.Sha, types.CheckoutRefOptions{}) }, }) } func (self *LocalCommitsController) handleCreateCommitResetMenu(commit *models.Commit) error { - return self.refHelper.CreateGitResetMenu(commit.Sha) + return self.refsHelper.CreateGitResetMenu(commit.Sha) } func (self *LocalCommitsController) handleOpenSearch(string) error { diff --git a/pkg/gui/controllers/tags_controller.go b/pkg/gui/controllers/tags_controller.go index 1ba03451c..0ba73857e 100644 --- a/pkg/gui/controllers/tags_controller.go +++ b/pkg/gui/controllers/tags_controller.go @@ -14,9 +14,9 @@ type TagsController struct { getContext func() *context.TagsContext git *commands.GitCommand getContexts func() context.ContextTree - tagActions *TagActions + tagsHelper *TagsHelper - refHelper IRefHelper + refsHelper IRefsHelper suggestionsHelper ISuggestionsHelper switchToSubCommitsContext func(string) error @@ -29,8 +29,8 @@ func NewTagsController( getContext func() *context.TagsContext, git *commands.GitCommand, getContexts func() context.ContextTree, - tagActions *TagActions, - refHelper IRefHelper, + tagsHelper *TagsHelper, + refsHelper IRefsHelper, suggestionsHelper ISuggestionsHelper, switchToSubCommitsContext func(string) error, @@ -40,8 +40,8 @@ func NewTagsController( getContext: getContext, git: git, getContexts: getContexts, - tagActions: tagActions, - refHelper: refHelper, + tagsHelper: tagsHelper, + refsHelper: refsHelper, suggestionsHelper: suggestionsHelper, switchToSubCommitsContext: switchToSubCommitsContext, @@ -88,7 +88,7 @@ func (self *TagsController) Keybindings(getKey func(key string) interface{}, con func (self *TagsController) checkout(tag *models.Tag) error { self.c.LogAction(self.c.Tr.Actions.CheckoutTag) - if err := self.refHelper.CheckoutRef(tag.Name, types.CheckoutRefOptions{}); err != nil { + if err := self.refsHelper.CheckoutRef(tag.Name, types.CheckoutRefOptions{}); err != nil { return err } return self.c.PushContext(self.getContexts().Branches) @@ -146,12 +146,12 @@ func (self *TagsController) push(tag *models.Tag) error { } func (self *TagsController) createResetMenu(tag *models.Tag) error { - return self.refHelper.CreateGitResetMenu(tag.Name) + return self.refsHelper.CreateGitResetMenu(tag.Name) } func (self *TagsController) create() error { // leaving commit SHA blank so that we're just creating the tag for the current commit - return self.tagActions.CreateTagMenu("", func() { self.getContext().GetPanelState().SetSelectedLineIdx(0) }) + return self.tagsHelper.CreateTagMenu("", func() { self.getContext().GetPanelState().SetSelectedLineIdx(0) }) } func (self *TagsController) withSelectedTag(f func(tag *models.Tag) error) func() error { diff --git a/pkg/gui/controllers/tag_actions.go b/pkg/gui/controllers/tags_helper.go index a48c339ef..6cec4fe4d 100644 --- a/pkg/gui/controllers/tag_actions.go +++ b/pkg/gui/controllers/tags_helper.go @@ -5,23 +5,23 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/types" ) -// Actions structs are for defining functionality that could be used by multiple contexts. +// Helper structs are for defining functionality that could be used by multiple contexts. // For example, here we have a CreateTagMenu which is applicable to both the tags context // and the commits context. -type TagActions struct { +type TagsHelper struct { c *types.ControllerCommon git *commands.GitCommand } -func NewTagActions(c *types.ControllerCommon, git *commands.GitCommand) *TagActions { - return &TagActions{ +func NewTagsHelper(c *types.ControllerCommon, git *commands.GitCommand) *TagsHelper { + return &TagsHelper{ c: c, git: git, } } -func (self *TagActions) CreateTagMenu(commitSha string, onCreate func()) error { +func (self *TagsHelper) CreateTagMenu(commitSha string, onCreate func()) error { return self.c.Menu(types.CreateMenuOptions{ Title: self.c.Tr.TagMenuTitle, Items: []*types.MenuItem{ @@ -41,14 +41,14 @@ func (self *TagActions) CreateTagMenu(commitSha string, onCreate func()) error { }) } -func (self *TagActions) afterTagCreate(onCreate func()) error { +func (self *TagsHelper) afterTagCreate(onCreate func()) error { onCreate() return self.c.Refresh(types.RefreshOptions{ Mode: types.ASYNC, Scope: []types.RefreshableView{types.COMMITS, types.TAGS}, }) } -func (self *TagActions) handleCreateAnnotatedTag(commitSha string, onCreate func()) error { +func (self *TagsHelper) handleCreateAnnotatedTag(commitSha string, onCreate func()) error { return self.c.Prompt(types.PromptOpts{ Title: self.c.Tr.TagNameTitle, HandleConfirm: func(tagName string) error { @@ -66,7 +66,7 @@ func (self *TagActions) handleCreateAnnotatedTag(commitSha string, onCreate func }) } -func (self *TagActions) handleCreateLightweightTag(commitSha string, onCreate func()) error { +func (self *TagsHelper) handleCreateLightweightTag(commitSha string, onCreate func()) error { return self.c.Prompt(types.PromptOpts{ Title: self.c.Tr.TagNameTitle, HandleConfirm: func(tagName string) error { diff --git a/pkg/gui/controllers/types.go b/pkg/gui/controllers/types.go index 19e3769a5..ec0b71a90 100644 --- a/pkg/gui/controllers/types.go +++ b/pkg/gui/controllers/types.go @@ -5,7 +5,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/types" ) -type IRefHelper interface { +type IRefsHelper interface { CheckoutRef(ref string, options types.CheckoutRefOptions) error CreateGitResetMenu(ref string) error ResetToRef(ref string, strength string, envVars []string) error diff --git a/pkg/gui/controllers/undo_controller.go b/pkg/gui/controllers/undo_controller.go index 571be4251..89bc6ea9e 100644 --- a/pkg/gui/controllers/undo_controller.go +++ b/pkg/gui/controllers/undo_controller.go @@ -23,7 +23,7 @@ type UndoController struct { c *types.ControllerCommon git *commands.GitCommand - refHelper IRefHelper + refsHelper IRefsHelper workingTreeHelper IWorkingTreeHelper getFilteredReflogCommits func() []*models.Commit @@ -34,7 +34,7 @@ var _ types.IController = &UndoController{} func NewUndoController( c *types.ControllerCommon, git *commands.GitCommand, - refHelper IRefHelper, + refsHelper IRefsHelper, workingTreeHelper IWorkingTreeHelper, getFilteredReflogCommits func() []*models.Commit, @@ -42,7 +42,7 @@ func NewUndoController( return &UndoController{ c: c, git: git, - refHelper: refHelper, + refsHelper: refsHelper, workingTreeHelper: workingTreeHelper, getFilteredReflogCommits: getFilteredReflogCommits, @@ -111,7 +111,7 @@ func (self *UndoController) reflogUndo() error { }) case CHECKOUT: self.c.LogAction(self.c.Tr.Actions.Undo) - return true, self.refHelper.CheckoutRef(action.from, types.CheckoutRefOptions{ + return true, self.refsHelper.CheckoutRef(action.from, types.CheckoutRefOptions{ EnvVars: undoEnvVars, WaitingStatus: undoingStatus, }) @@ -149,7 +149,7 @@ func (self *UndoController) reflogRedo() error { }) case CHECKOUT: self.c.LogAction(self.c.Tr.Actions.Redo) - return true, self.refHelper.CheckoutRef(action.to, types.CheckoutRefOptions{ + return true, self.refsHelper.CheckoutRef(action.to, types.CheckoutRefOptions{ EnvVars: redoEnvVars, WaitingStatus: redoingStatus, }) @@ -224,7 +224,7 @@ type hardResetOptions struct { // only to be used in the undo flow for now (does an autostash) func (self *UndoController) hardResetWithAutoStash(commitSha string, options hardResetOptions) error { reset := func() error { - if err := self.refHelper.ResetToRef(commitSha, "hard", options.EnvVars); err != nil { + if err := self.refsHelper.ResetToRef(commitSha, "hard", options.EnvVars); err != nil { return self.c.Error(err) } return nil |