summaryrefslogtreecommitdiffstats
path: root/pkg/gui/stash_panel.go
blob: 439d8205e6dfe0dc6b88ff39753b58ba626480ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package gui

import "github.com/jesseduffield/lazygit/pkg/gui/types"

func (gui *Gui) stashRenderToMain() error {
	var task types.UpdateTask
	stashEntry := gui.State.Contexts.Stash.GetSelected()
	if stashEntry == nil {
		task = types.NewRenderStringTask(gui.c.Tr.NoStashEntries)
	} else {
		task = types.NewRunPtyTask(gui.git.Stash.ShowStashEntryCmdObj(stashEntry.Index).GetCmd())
	}

	return gui.c.RenderToMainViews(types.RefreshMainOpts{
		Pair: gui.c.MainViewPairs().Normal,
		Main: &types.ViewUpdateOpts{
			Title: "Stash",
			Task:  task,
		},
	})
}