Documentation ¶
Overview ¶
Package bubbletea provides middleware for serving bubbletea apps over SSH.
Index ¶
- func MakeOptions(sess ssh.Session) []tea.ProgramOption
- func MakeRenderer(sess ssh.Session) *lipgloss.Renderer
- func Middleware(handler Handler) wish.Middleware
- func MiddlewareWithColorProfile(handler Handler, profile termenv.Profile) wish.Middleware
- func MiddlewareWithProgramHandler(handler ProgramHandler, profile termenv.Profile) wish.Middleware
- type BubbleTeaHandlerdeprecated
- type Handler
- type ProgramHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeOptions ¶
func MakeOptions(sess ssh.Session) []tea.ProgramOption
MakeOptions returns the tea.WithInput and tea.WithOutput program options taking into account possible Emulated or Allocated PTYs.
func MakeRenderer ¶
MakeRenderer returns a lipgloss renderer for the current session. This function handle PTYs as well, and should be used to style your application.
func Middleware ¶
func Middleware(handler Handler) wish.Middleware
Middleware takes a Handler and hooks the input and output for the ssh.Session into the tea.Program.
It also captures window resize events and sends them to the tea.Program as tea.WindowSizeMsgs.
func MiddlewareWithColorProfile ¶
func MiddlewareWithColorProfile(handler Handler, profile termenv.Profile) wish.Middleware
MiddlewareWithColorProfile allows you to specify the minimum number of colors this program needs to work properly.
If the client's color profile has less colors than p, p will be forced. Use with caution.
func MiddlewareWithProgramHandler ¶
func MiddlewareWithProgramHandler(handler ProgramHandler, profile termenv.Profile) wish.Middleware
MiddlewareWithProgramHandler allows you to specify the ProgramHandler to be able to access the underlying tea.Program, and the minimum supported color profile.
This is useful for creating custom middlewares that need access to tea.Program for instance to use p.Send() to send messages to tea.Program.
Make sure to set the tea.WithInput and tea.WithOutput to the ssh.Session otherwise the program will not function properly. The recommended way of doing so is by using MakeOptions.
If the client's color profile has less colors than p, p will be forced. Use with caution.
Types ¶
type BubbleTeaHandler
deprecated
type BubbleTeaHandler = Handler // nolint: revive
BubbleTeaHandler is the function Bubble Tea apps implement to hook into the SSH Middleware. This will create a new tea.Program for every connection and start it with the tea.ProgramOptions returned.
Deprecated: use Handler instead.
type Handler ¶
Handler is the function Bubble Tea apps implement to hook into the SSH Middleware. This will create a new tea.Program for every connection and start it with the tea.ProgramOptions returned.
type ProgramHandler ¶
ProgramHandler is the function Bubble Tea apps implement to hook into the SSH Middleware. This should return a new tea.Program. This handler is different from the default handler in that it returns a tea.Program instead of (tea.Model, tea.ProgramOptions).
Make sure to set the tea.WithInput and tea.WithOutput to the ssh.Session otherwise the program will not function properly.