Skip to content

Commit e5b05e3

Browse files
committed
feat: program accessor funcs
1 parent 5b95f73 commit e5b05e3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

container.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ func (c *Container) Shutdown(finalizers ...func()) {
285285
close(fin)
286286
}
287287

288+
func (c *Container) Program() *Program {
289+
return c.program
290+
}
291+
288292
func (c *Container) Height() int {
289293
c.stateMu.RLock()
290294
defer c.stateMu.RUnlock()

program.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ func NewProgram(ctx context.Context, model tea.Model, in io.Reader, out io.Write
3131
}
3232
}
3333

34+
func (p *Program) SetTeaProgram(program *tea.Program) {
35+
if p.started || p.suspended {
36+
panic("cannot set program after it has started or suspended")
37+
}
38+
p.program = program
39+
}
40+
3441
func (p *Program) Run() (tea.Model, error) {
3542
if p.started || p.suspended {
3643
return nil, fmt.Errorf("program already started")

0 commit comments

Comments
 (0)