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

allow playing and updating snapshots

This commit is contained in:
Jesse Duffield 2021-04-05 20:49:32 +10:00
parent c33f8d2790
commit abdd2455bb

@ -122,6 +122,20 @@ func main() {
log.Panicln(err)
}
if err := g.SetKeybinding("list", nil, 's', gocui.ModNone, func(*gocui.Gui, *gocui.View) error {
currentTest := app.getCurrentTest()
if currentTest == nil {
return nil
}
cmd := secureexec.Command("sh", "-c", fmt.Sprintf("UPDATE_SNAPSHOTS=true go run integration/main.go %s", currentTest.Name))
app.runSubprocess(cmd)
return nil
}); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("list", nil, 'o', gocui.ModNone, func(*gocui.Gui, *gocui.View) error {
currentTest := app.getCurrentTest()
if currentTest == nil {
@ -332,7 +346,7 @@ func (app *App) layout(g *gocui.Gui) error {
keybindingsView.Title = "Keybindings"
keybindingsView.Wrap = true
keybindingsView.FgColor = gocui.ColorDefault
fmt.Fprintln(keybindingsView, "up/down: navigate, enter: run test, r: record test, o: open test config, n: duplicate test, m: rename test, d: delete test")
fmt.Fprintln(keybindingsView, "up/down: navigate, enter: run test, s: run test and update snapshots, r: record test, o: open test config, n: duplicate test, m: rename test, d: delete test")
}
editorView, err := g.SetViewBeneath("editor", "keybindings", editorViewHeight)