diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-02 10:34:33 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:09:53 +1100 |
commit | f503ff1ecbfda00dfa4e68e38d41aceaf9b4400c (patch) | |
tree | e113663684406ca893ebb9c223d1fddbc65abea9 /pkg/gui/gui.go | |
parent | 4a1d23dc27f61e936fb3b582f02e2bba473c3b19 (diff) |
start breaking up git struct
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 18c6068f7..e6aaa6186 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -12,6 +12,7 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/common" @@ -433,12 +434,16 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) { // for now the split view will always be on // NewGui builds a new gui handler -func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error) { - +func NewGui( + cmn *common.Common, + config config.AppConfigurer, + gitConfig git_config.IGitConfig, + updater *updates.Updater, + filterPath string, + showRecentRepos bool, +) (*Gui, error) { gui := &Gui{ Common: cmn, - GitCommand: gitCommand, - OSCommand: oSCommand, Config: config, Updater: updater, statusManager: &statusManager{}, @@ -455,11 +460,30 @@ func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *osco ShowExtrasWindow: cmn.UserConfig.Gui.ShowCommandLog && !config.GetAppState().HideCommandLog, } + guiIO := oscommands.NewGuiIO( + cmn.Log, + gui.logCommand, + gui.getCmdWriter, + gui.promptUserForCredential, + ) + + osCommand := oscommands.NewOSCommand(cmn, oscommands.GetPlatform(), guiIO) + + gui.OSCommand = osCommand + var err error + gui.GitCommand, err = commands.NewGitCommand( + cmn, + osCommand, + gitConfig, + ) + if err != nil { + return nil, err + } + gui.resetState(filterPath, false) gui.watchFilesForChanges() - oSCommand.SetLogCommandFn(gui.logCommand) gui.PopupHandler = &RealPopupHandler{gui: gui} authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors) |