summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/types.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-16 14:46:53 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit1dd7307fde033dae5fececac15810a99e26c3d91 (patch)
tree4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/controllers/types.go
parenta90b6efded49abcfa2516db794d7875b0396f558 (diff)
start moving commit panel handlers into controller
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers
Diffstat (limited to 'pkg/gui/controllers/types.go')
-rw-r--r--pkg/gui/controllers/types.go53
1 files changed, 52 insertions, 1 deletions
diff --git a/pkg/gui/controllers/types.go b/pkg/gui/controllers/types.go
index 75abc1704..21f774944 100644
--- a/pkg/gui/controllers/types.go
+++ b/pkg/gui/controllers/types.go
@@ -1,6 +1,9 @@
package controllers
import (
+ "github.com/jesseduffield/lazygit/pkg/commands/models"
+ "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+ "github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/popup"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -8,6 +11,54 @@ import (
type IGuiCommon interface {
popup.IPopupHandler
- LogAction(string)
+ LogAction(action string)
+ LogCommand(cmdStr string, isCommandLine bool)
+ // we call this when we want to refetch some models and render the result. Internally calls PostRefreshUpdate
Refresh(types.RefreshOptions) error
+ // we call this when we've changed something in the view model but not the actual model,
+ // e.g. expanding or collapsing a folder in a file view. Calling 'Refresh' in this
+ // case would be overkill, although refresh will internally call 'PostRefreshUpdate'
+ PostRefreshUpdate(types.Context) error
+ RunSubprocessAndRefresh(oscommands.ICmdObj) error
+ PushContext(context types.Context, opts ...types.OnFocusOpts) error
+ PopContext() error
+
+ GetAppState() *config.AppState
+ SaveAppState() error
+}
+
+type IRefHelper interface {
+ CheckoutRef(ref string, options types.CheckoutRefOptions) error
+ CreateGitResetMenu(ref string) error
+ ResetToRef(ref string, strength string, envVars []string) error
+}
+
+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
+ GetCustomCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion
+}
+
+type IFileHelper interface {
+ EditFile(filename string) error
+ EditFileAtLine(filename string, lineNumber int) error
+ OpenFile(filename string) error
+}
+
+type IWorkingTreeHelper interface {
+ AnyStagedFiles() bool
+ AnyTrackedFiles() bool
+ IsWorkingTreeDirty() bool
+ FileForSubmodule(submodule *models.SubmoduleConfig) *models.File
+}
+
+// all fields mandatory (except `CanRebase` because it's boolean)
+type SwitchToCommitFilesContextOpts struct {
+ RefName string
+ CanRebase bool
+ Context types.Context
+ WindowName string
}