terminal

package
v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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
	ColorEnabled bool
}

IOStreams provides a set of input/output streams for terminal interactions. It encapsulates standard input, output, error output, and a flag indicating whether color output is enabled.

func NewIOStreams

func NewIOStreams(in io.ReadCloser, out, errOut io.Writer, colorEnabled bool) *IOStreams

NewIOStreams creates and returns a new IOStreams instance with the provided input, output, error output streams, and a flag indicating whether color output is enabled.

func NewTestIOStreams

func NewTestIOStreams() (*IOStreams, *bytes.Buffer, *bytes.Buffer)

NewTestIOStreams creates an IOStreams instance for testing with buffers that can be read and validated. Returns the IOStreams, out buffer, and errOut buffer.

type PrefixedWriter added in v0.4.0

type PrefixedWriter struct {
	// contains filtered or unexported fields
}

PrefixedWriter wraps an io.Writer and prepends a prefix to each line of output. It is safe for concurrent use. When multiple actions run in parallel, each action gets a PrefixedWriter with its name, so output lines are clearly attributed.

func NewPrefixedWriter added in v0.4.0

func NewPrefixedWriter(out io.Writer, name string) *PrefixedWriter

NewPrefixedWriter creates a writer that prefixes each line with the given string. The prefix is formatted as "[name] " and prepended to the start of each line.

func (*PrefixedWriter) Write added in v0.4.0

func (pw *PrefixedWriter) Write(p []byte) (int, error)

Write implements io.Writer. It scans each byte for newlines and inserts the prefix at the beginning of each new line.

Directories

Path Synopsis
Package format provides human-readable formatting utilities for bytes and durations.
Package format provides human-readable formatting utilities for bytes and durations.
Package input provides interactive user input functionality for the terminal.
Package input provides interactive user input functionality for the terminal.
Package kvx provides integration with the kvx data viewer library for scafctl.
Package kvx provides integration with the kvx data viewer library for scafctl.
Package output provides output formatting utilities for scafctl commands.
Package output provides output formatting utilities for scafctl commands.
Package writer provides a centralized CLI output writer for scafctl.
Package writer provides a centralized CLI output writer for scafctl.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL