1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-29 23:17:32 +02:00

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" "github.com/samber/lo"
) )
type ICommitsHelper interface {
UpdateCommitPanelView(message string)
}
type CommitsHelper struct { type CommitsHelper struct {
c *HelperCommon c *HelperCommon
@ -26,8 +22,6 @@ type CommitsHelper struct {
setCommitDescription func(string) setCommitDescription func(string)
} }
var _ ICommitsHelper = &CommitsHelper{}
func NewCommitsHelper( func NewCommitsHelper(
c *HelperCommon, c *HelperCommon,
getCommitSummary func() string, getCommitSummary func() string,

View File

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

View File

@ -6,11 +6,6 @@ import (
// this helper just wraps our hosting_service package // 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 { type HostHelper struct {
c *HelperCommon c *HelperCommon
} }

View File

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

View File

@ -14,15 +14,6 @@ import (
"github.com/samber/lo" "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 { type RefsHelper struct {
c *HelperCommon c *HelperCommon
} }
@ -35,8 +26,6 @@ func NewRefsHelper(
} }
} }
var _ IRefsHelper = &RefsHelper{}
func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) error { func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) error {
waitingStatus := options.WaitingStatus waitingStatus := options.WaitingStatus
if 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 // finding suggestions in this file, so that it's easy to see if a function already
// exists for fetching a particular model. // 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 { type SuggestionsHelper struct {
c *HelperCommon c *HelperCommon
} }
var _ ISuggestionsHelper = &SuggestionsHelper{}
func NewSuggestionsHelper( func NewSuggestionsHelper(
c *HelperCommon, c *HelperCommon,
) *SuggestionsHelper { ) *SuggestionsHelper {

View File

@ -14,15 +14,6 @@ type UpstreamHelper struct {
getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion 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( func NewUpstreamHelper(
c *HelperCommon, c *HelperCommon,
getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion, getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion,

View File

@ -12,13 +12,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/types" "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 { type WorkingTreeHelper struct {
c *HelperCommon c *HelperCommon
refHelper *RefsHelper refHelper *RefsHelper

View File

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