1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00

Rename CmdLog -> GuiLog

We want to log both actions and commands for the sake of integration tests
This commit is contained in:
Jesse Duffield 2023-05-13 20:43:26 +10:00
parent 9514284f8e
commit 114ad52ff6
3 changed files with 6 additions and 5 deletions

View File

@ -30,6 +30,7 @@ func (gui *Gui) LogAction(action string) {
gui.Views.Extras.Autoscroll = true gui.Views.Extras.Autoscroll = true
gui.GuiLog = append(gui.GuiLog, action)
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(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 // we style it differently to communicate that
textStyle = style.FgMagenta textStyle = style.FgMagenta
} }
gui.CmdLog = append(gui.CmdLog, cmdStr) gui.GuiLog = append(gui.GuiLog, cmdStr)
indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1) indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1)
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr)) fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
} }

View File

@ -93,8 +93,8 @@ type Gui struct {
Views types.Views Views types.Views
// Log of the commands that get run, to be displayed to the user. // Log of the commands/actions logged in the Command Log panel.
CmdLog []string GuiLog []string
// the extras window contains things like the command log // the extras window contains things like the command log
ShowExtrasWindow bool ShowExtrasWindow bool
@ -440,7 +440,7 @@ func NewGui(
showRecentRepos: showRecentRepos, showRecentRepos: showRecentRepos,
RepoPathStack: &utils.StringStack{}, RepoPathStack: &utils.StringStack{},
RepoStateMap: map[Repo]*GuiRepoState{}, RepoStateMap: map[Repo]*GuiRepoState{},
CmdLog: []string{}, GuiLog: []string{},
// originally we could only hide the command log permanently via the config // 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 // but now we do it via state. So we need to still support the config for the

View File

@ -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, "%s\nFinal Lazygit state:\n%s\nUpon failure, focused view was '%s'.\nLog:\n%s", message,
self.gui.g.Snapshot(), self.gui.g.Snapshot(),
currentView.Name(), currentView.Name(),
strings.Join(self.gui.CmdLog, "\n"), strings.Join(self.gui.GuiLog, "\n"),
) )
self.gui.g.Close() self.gui.g.Close()