Cleanup: remove unused interfaces for helpers

I can only guess here: maybe they were added to more clearly document the public
interface of the classes? If so, I don't think that works. Developers who are
not familiar with the convention will just add a new public method to the class
without updating the interface.
This commit is contained in:
Stefan Haller 2024-10-11 16:53:27 +02:00
parent b3215a750c
commit 8ba57b6bd0
9 changed files with 0 additions and 65 deletions

View file

@ -12,10 +12,6 @@ import (
"github.com/samber/lo"
)
type ICommitsHelper interface {
UpdateCommitPanelView(message string)
}
type CommitsHelper struct {
c *HelperCommon
@ -26,8 +22,6 @@ type CommitsHelper struct {
setCommitDescription func(string)
}
var _ ICommitsHelper = &CommitsHelper{}
func NewCommitsHelper(
c *HelperCommon,
getCommitSummary func() string,

View file

@ -6,12 +6,6 @@ import (
"github.com/samber/lo"
)
type IFilesHelper interface {
EditFiles(filenames []string) error
EditFileAtLine(filename string, lineNumber int) error
OpenFile(filename string) error
}
type FilesHelper struct {
c *HelperCommon
}
@ -22,8 +16,6 @@ func NewFilesHelper(c *HelperCommon) *FilesHelper {
}
}
var _ IFilesHelper = &FilesHelper{}
func (self *FilesHelper) EditFiles(filenames []string) error {
absPaths := lo.Map(filenames, func(filename string, _ int) string {
absPath, err := filepath.Abs(filename)

View file

@ -6,11 +6,6 @@ import (
// this helper just wraps our hosting_service package
type IHostHelper interface {
GetPullRequestURL(from string, to string) (string, error)
GetCommitURL(commitHash string) (string, error)
}
type HostHelper struct {
c *HelperCommon
}

View file

@ -9,10 +9,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type IPatchBuildingHelper interface {
ValidateNormalWorkingTreeState() (bool, error)
}
type PatchBuildingHelper struct {
c *HelperCommon
}

View file

@ -14,15 +14,6 @@ import (
"github.com/samber/lo"
)
type IRefsHelper interface {
CheckoutRef(ref string, options types.CheckoutRefOptions) error
GetCheckedOutRef() *models.Branch
CreateGitResetMenu(ref string) error
CreateCheckoutMenu(commit *models.Commit) error
ResetToRef(ref string, strength string, envVars []string) error
NewBranch(from string, fromDescription string, suggestedBranchname string) error
}
type RefsHelper struct {
c *HelperCommon
}
@ -35,8 +26,6 @@ func NewRefsHelper(
}
}
var _ IRefsHelper = &RefsHelper{}
func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) error {
waitingStatus := options.WaitingStatus
if waitingStatus == "" {

View file

@ -26,20 +26,10 @@ import (
// finding suggestions in this file, so that it's easy to see if a function already
// exists for fetching a particular model.
type ISuggestionsHelper interface {
GetRemoteSuggestionsFunc() func(string) []*types.Suggestion
GetBranchNameSuggestionsFunc() func(string) []*types.Suggestion
GetFilePathSuggestionsFunc() func(string) []*types.Suggestion
GetRemoteBranchesSuggestionsFunc(separator string) func(string) []*types.Suggestion
GetRefsSuggestionsFunc() func(string) []*types.Suggestion
}
type SuggestionsHelper struct {
c *HelperCommon
}
var _ ISuggestionsHelper = &SuggestionsHelper{}
func NewSuggestionsHelper(
c *HelperCommon,
) *SuggestionsHelper {

View file

@ -14,15 +14,6 @@ type UpstreamHelper struct {
getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion
}
type IUpstreamHelper interface {
ParseUpstream(string) (string, string, error)
PromptForUpstreamWithInitialContent(*models.Branch, func(string) error) error
PromptForUpstreamWithoutInitialContent(*models.Branch, func(string) error) error
GetSuggestedRemote() string
}
var _ IUpstreamHelper = &UpstreamHelper{}
func NewUpstreamHelper(
c *HelperCommon,
getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion,

View file

@ -12,13 +12,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type IWorkingTreeHelper interface {
AnyStagedFiles() bool
AnyTrackedFiles() bool
IsWorkingTreeDirty() bool
FileForSubmodule(submodule *models.SubmoduleConfig) *models.File
}
type WorkingTreeHelper struct {
c *HelperCommon
refHelper *RefsHelper

View file

@ -12,11 +12,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
type IWorktreeHelper interface {
GetMainWorktreeName() string
GetCurrentWorktreeName() string
}
type WorktreeHelper struct {
c *HelperCommon
reposHelper *ReposHelper