18 lines
310 B
Go
18 lines
310 B
Go
package commandctrl
|
|
|
|
import (
|
|
"context"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type commandCtlKeyType struct{}
|
|
|
|
var commandCtlKey = commandCtlKeyType{}
|
|
|
|
func PostMsg(ctx context.Context, msg tea.Msg) {
|
|
cmdCtl, ok := ctx.Value(commandCtlKey).(*CommandController)
|
|
if ok {
|
|
cmdCtl.postMessage(msg)
|
|
}
|
|
}
|