1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

simplify how we log commands

This commit is contained in:
Jesse Duffield
2022-01-05 11:57:32 +11:00
parent e524e39842
commit 05fa483f48
44 changed files with 291 additions and 233 deletions

View File

@ -13,9 +13,6 @@ import (
)
func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) {
// closing over this so that nobody else can modify it
currentSpan := ""
return func(entry oscommands.CmdLogEntry) {
if gui.Views.Extras == nil {
return
@ -23,11 +20,6 @@ func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) {
gui.Views.Extras.Autoscroll = true
if entry.GetSpan() != currentSpan {
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(entry.GetSpan()))
currentSpan = entry.GetSpan()
}
textStyle := theme.DefaultTextColor
if !entry.GetCommandLine() {
textStyle = style.FgMagenta
@ -38,6 +30,16 @@ func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) {
}
}
func (gui *Gui) logSpan(span string) {
if gui.Views.Extras == nil {
return
}
gui.Views.Extras.Autoscroll = true
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(span))
}
func (gui *Gui) printCommandLogHeader() {
introStr := fmt.Sprintf(
gui.Tr.CommandLogHeader,