Documentation ¶
Overview ¶
Package io contains custom functions extending the native `io` package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BellSkipper ¶
type BellSkipper struct {
// contains filtered or unexported fields
}
BellSkipper is a custom WriteCloser that skips `Bell` characters
Used to prevent promptui making sounds when a button is pressed
func NewBellSkipper ¶
func NewBellSkipper(baseOutput systemio.WriteCloser) *BellSkipper
NewBellSkipper creates a new BellSkipper WriteCloser
type ContinuousReader ¶
type ContinuousReader struct {
// contains filtered or unexported fields
}
ContinuousReader is an io.Reader that wraps another reader and ignores io.EOF markers
This can be useful if you want to continue reading from a buffered reader after the buffer has been exhausted, for example
type ErrorReader ¶ added in v0.32.28
type ErrorReader struct { }
func NewErrorReader ¶ added in v0.32.28
func NewErrorReader() *ErrorReader
type PipedWriteCloser ¶ added in v0.33.3
type PipedWriteCloser struct {
// contains filtered or unexported fields
}
PipedWriteCloser is a simple struct that wraps an io.Pipe and a sync.WaitGroup for convenience
Use a PipedWriteCloser when a WriteCloser is expected by some interface and you need a simple way of reading all data written once the io.WriteCloser has been closed
func NewPipedWriteCloser ¶ added in v0.33.3
func NewPipedWriteCloser() *PipedWriteCloser
NewPipedWriteCloser creates a new PipedWriteCloser
The PipedWriteCloser will be ready to be written to and the sync.WaitGroup will be waiting for the io.WriteCloser to close, after which it will store the result and unblock any previous calls to Wait()
func (*PipedWriteCloser) Bytes ¶ added in v0.33.3
func (writeCloser *PipedWriteCloser) Bytes() []byte
Bytes returns all the data written to the writer as a slice of byte
If called before Wait(), the result is undefined
func (*PipedWriteCloser) Close ¶ added in v0.33.3
func (writeCloser *PipedWriteCloser) Close() error
Closer is the interface that wraps the basic Close method.
func (*PipedWriteCloser) String ¶ added in v0.33.3
func (writeCloser *PipedWriteCloser) String() string
Bytes returns all the data written to the writer as a string
If called before Wait(), the result is undefined
func (*PipedWriteCloser) Wait ¶ added in v0.33.3
func (writeCloser *PipedWriteCloser) Wait()
Wait blocks until the WaitGroup counter is zero.
type SynchronizedBuffer ¶ added in v0.36.0
type SynchronizedBuffer struct {
// contains filtered or unexported fields
}
func NewSynchronizedBuffer ¶ added in v0.36.0
func NewSynchronizedBuffer() *SynchronizedBuffer
func (*SynchronizedBuffer) Bytes ¶ added in v0.36.0
func (syncBuffer *SynchronizedBuffer) Bytes() []byte
func (*SynchronizedBuffer) Read ¶ added in v0.36.0
func (syncBuffer *SynchronizedBuffer) Read(p []byte) (int, error)
func (*SynchronizedBuffer) String ¶ added in v0.36.0
func (syncBuffer *SynchronizedBuffer) String() string