Documentation
¶
Overview ¶
Package output provides structures and functions to handle command output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lines ¶
type Lines []string
Lines represents a collection of output lines from a command execution.
It is essentially a slice of strings, where each string is a line of output.
func NewLines ¶
NewLines creates and returns a new Lines instance from the provided slice of strings.
Parameters:
- lines: A slice of strings representing the lines of output.
func (Lines) At ¶
At returns the line at the specified index.
If idx is negative, it is interpreted as an offset from the end of the slice (e.g., -1 refers to the last line, -2 to the second-to-last, etc.). It returns an empty string if there are no lines or if the index is out of bounds.
func (Lines) First ¶
First returns the first line.
It returns an empty string if there are no lines.
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output represents the output of a system command execution.
func NewOutput ¶
NewOutput creates and returns a new Output instance with the specified standard output.
Parameters:
- stdout: A byte slice representing the standard output of the command.
func (Output) Bytes ¶
Bytes returns the output as a byte slice.
It returns a copy of the internal byte slice to prevent external modification.