Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SharedReader ¶
type SharedReader struct { // contains filtered or unexported fields }
SharedReader implements the io.Reader interface: https://pkg.go.dev/io#Reader, which allows us to provide it as the input reader for bubbletea: e.g tea.NewProgram(m, tea.WithInput(stdinReader{})
At any given time, SharedReader can be in one of two modes:
1: bubbletea mode: In this mode, we say we are "detached" from stdin, all input is read and processed by the bubbletea library. 2: normal mode: In this mode, cased-cli consumes stdin input normally.
func New ¶
func New(input io.Reader) *SharedReader
New creates a new SharedReader instance which consumes input from the io.Reader object given, e.g. os.Stdin.
func (*SharedReader) Attach ¶
func (r *SharedReader) Attach()
Attach switches input mode from bubbletea to normal
func (*SharedReader) Detach ¶
func (r *SharedReader) Detach()
Detach switches input mode from normal to bubbletea.
func (*SharedReader) IsDetached ¶
func (r *SharedReader) IsDetached() bool
func (*SharedReader) ReadLoop ¶
func (r *SharedReader) ReadLoop()
ReadLoop forward data read to the inputChan channel. This blocks, it's meant to be running in a separate goroutine.
Click to show internal directories.
Click to hide internal directories.