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

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

type ParentContextMgr struct {
	ParentContext types.Context
	// we can't know on the calling end whether a Context is actually a nil value without reflection, so we're storing this flag here to tell us. There has got to be a better way around this
	hasParent bool
}

var _ types.ParentContexter = (*ParentContextMgr)(nil)

func (self *ParentContextMgr) SetParentContext(context types.Context) {
	self.ParentContext = context
	self.hasParent = true
}

func (self *ParentContextMgr) GetParentContext() (types.Context, bool) {
	return self.ParentContext, self.hasParent
}