Documentation
¶
Index ¶
- type IOStreams
- func (s *IOStreams) CanPrompt() bool
- func (s *IOStreams) ClearScreen()
- func (s *IOStreams) ColorEnabled() bool
- func (s *IOStreams) IsStderrTTY() bool
- func (s *IOStreams) IsStdoutTTY() bool
- func (s *IOStreams) SetColorEnabled(enabled bool)
- func (s *IOStreams) StartAlternateScreenBuffer()
- func (s *IOStreams) StopAlternateScreenBuffer()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IOStreams ¶
type IOStreams struct {
In io.ReadCloser
Out io.Writer
ErrOut io.Writer
// contains filtered or unexported fields
}
IOStreams collects input and output streams for command execution.
The structure mirrors gh/jk ergonomics by exposing terminal metadata and lazy colour profile detection. Commands can inspect the terminal capabilities to decide when to render ANSI colours, tables, or spinner widgets.
func System ¶
func System() *IOStreams
System returns IOStreams bound to the current process standard streams and captures terminal metadata so downstream components can make ergonomic decisions (colours, paging, prompts, etc.).
func (*IOStreams) CanPrompt ¶
CanPrompt reports whether stdin is a TTY and therefore suitable for interactive prompts.
func (*IOStreams) ClearScreen ¶
func (s *IOStreams) ClearScreen()
ClearScreen clears the screen and moves cursor to top-left. Useful for refreshing watch mode output. No-op if not a TTY.
func (*IOStreams) ColorEnabled ¶
ColorEnabled returns true when ANSI colour output should be rendered. The decision is cached so repeated checks are inexpensive.
func (*IOStreams) IsStderrTTY ¶
IsStderrTTY reports whether stderr is attached to a terminal.
func (*IOStreams) IsStdoutTTY ¶
IsStdoutTTY reports whether stdout is attached to a terminal.
func (*IOStreams) SetColorEnabled ¶
SetColorEnabled allows callers (e.g. tests) to force colour behaviour.
func (*IOStreams) StartAlternateScreenBuffer ¶
func (s *IOStreams) StartAlternateScreenBuffer()
StartAlternateScreenBuffer switches to the alternate screen buffer. This keeps the terminal clean during watch mode, showing only the final result on the original screen when done. No-op if not a TTY.
func (*IOStreams) StopAlternateScreenBuffer ¶
func (s *IOStreams) StopAlternateScreenBuffer()
StopAlternateScreenBuffer switches back to the main screen buffer. No-op if not a TTY.