summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/parent_context_mgr.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/context/parent_context_mgr.go')
-rw-r--r--pkg/gui/context/parent_context_mgr.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/gui/context/parent_context_mgr.go b/pkg/gui/context/parent_context_mgr.go
new file mode 100644
index 000000000..50747a3a0
--- /dev/null
+++ b/pkg/gui/context/parent_context_mgr.go
@@ -0,0 +1,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
+}