From 114ad52ff61346bb4c4eaa64f157197ebfb998a5 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 13 May 2023 20:43:26 +1000 Subject: [PATCH] Rename CmdLog -> GuiLog We want to log both actions and commands for the sake of integration tests --- pkg/gui/command_log_panel.go | 3 ++- pkg/gui/gui.go | 6 +++--- pkg/gui/gui_driver.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/gui/command_log_panel.go b/pkg/gui/command_log_panel.go index 258a9cac1..c0aa83bec 100644 --- a/pkg/gui/command_log_panel.go +++ b/pkg/gui/command_log_panel.go @@ -30,6 +30,7 @@ func (gui *Gui) LogAction(action string) { gui.Views.Extras.Autoscroll = true + gui.GuiLog = append(gui.GuiLog, action) fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action)) } @@ -46,7 +47,7 @@ func (gui *Gui) LogCommand(cmdStr string, commandLine bool) { // we style it differently to communicate that textStyle = style.FgMagenta } - gui.CmdLog = append(gui.CmdLog, cmdStr) + gui.GuiLog = append(gui.GuiLog, cmdStr) indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1) fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr)) } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 6b42da4fc..b429bda27 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -93,8 +93,8 @@ type Gui struct { Views types.Views - // Log of the commands that get run, to be displayed to the user. - CmdLog []string + // Log of the commands/actions logged in the Command Log panel. + GuiLog []string // the extras window contains things like the command log ShowExtrasWindow bool @@ -440,7 +440,7 @@ func NewGui( showRecentRepos: showRecentRepos, RepoPathStack: &utils.StringStack{}, RepoStateMap: map[Repo]*GuiRepoState{}, - CmdLog: []string{}, + GuiLog: []string{}, // originally we could only hide the command log permanently via the config // but now we do it via state. So we need to still support the config for the diff --git a/pkg/gui/gui_driver.go b/pkg/gui/gui_driver.go index c409ebdb9..a90578b65 100644 --- a/pkg/gui/gui_driver.go +++ b/pkg/gui/gui_driver.go @@ -64,7 +64,7 @@ func (self *GuiDriver) Fail(message string) { "%s\nFinal Lazygit state:\n%s\nUpon failure, focused view was '%s'.\nLog:\n%s", message, self.gui.g.Snapshot(), currentView.Name(), - strings.Join(self.gui.CmdLog, "\n"), + strings.Join(self.gui.GuiLog, "\n"), ) self.gui.g.Close()