mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-13 20:04:25 +02:00
pull out function
This commit is contained in:
@@ -473,7 +473,16 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscom
|
|||||||
|
|
||||||
gui.watchFilesForChanges()
|
gui.watchFilesForChanges()
|
||||||
|
|
||||||
onRunCommand := func() func(entry oscommands.CmdLogEntry) {
|
onRunCommand := gui.GetOnRunCommand()
|
||||||
|
|
||||||
|
oSCommand.SetOnRunCommand(onRunCommand)
|
||||||
|
gui.OnRunCommand = onRunCommand
|
||||||
|
|
||||||
|
return gui, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) {
|
||||||
|
// closing over this so that nobody else can modify it
|
||||||
currentSpan := ""
|
currentSpan := ""
|
||||||
|
|
||||||
return func(entry oscommands.CmdLogEntry) {
|
return func(entry oscommands.CmdLogEntry) {
|
||||||
@@ -496,12 +505,6 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscom
|
|||||||
indentedCmdStr := " " + strings.Replace(entry.GetCmdStr(), "\n", "\n ", -1)
|
indentedCmdStr := " " + strings.Replace(entry.GetCmdStr(), "\n", "\n ", -1)
|
||||||
fmt.Fprintln(gui.Views.Extras, utils.ColoredString(indentedCmdStr, clrAttr))
|
fmt.Fprintln(gui.Views.Extras, utils.ColoredString(indentedCmdStr, clrAttr))
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
|
|
||||||
oSCommand.SetOnRunCommand(onRunCommand)
|
|
||||||
gui.OnRunCommand = onRunCommand
|
|
||||||
|
|
||||||
return gui, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run setup the gui with keybindings and start the mainloop
|
// Run setup the gui with keybindings and start the mainloop
|
||||||
|
Reference in New Issue
Block a user