Documentation
¶
Overview ¶
Package runbatch provides a framework for running batches of commands in parallel or serially.
It allows for easy management of command execution, including handling of working directories, context cancellation, and error reporting.
The main components of the package are:
### Runnable
An interface for something that can be run as part of a batch (either a Command or a nested Batch).
### OSCommand
A Runnable that runs a command in the OS.
### FunctionCommand
A Runnable that runs a go function in a goroutine.
### SerialBatch
A Runnable that runs a collection of commands or nested batches serially.
### ParallelBatch
A Runnable that runs a collection of commands or nested batches in parallel.
Command results are aggregated and returned as a Results type, which contains information about the execution. Results can be visualised using the WriteResults function and your favourite output io.Writer.
Signal handling is also supported, allowing for graceful termination of running commands. This is achieved by listening for OS signals and forwarding them to the appropriate command. See the signalbroker package for the signals that are caught by default.
Importantly, the first caught signal does not cancel the context but does get passed to any running OSCommands. This allows for graceful shutdown of the commands without terminating the entire process. The second caught signal (of the same type) will cancel the context and attempt to kill all running OSCommands. FunctionCommands must handle context cancellation themselves.
Package runbatch provides helper functions for progress reporting.
Index ¶
- Constants
- Variables
- func CreateChildReporterForBatch(parent progress.Reporter, batchLabel string) progress.Reporter
- func FullLabel(r Runnable) string
- func NewErrFunctionCmdPanic(v any) error
- func PropagateReporterToChildren(parent progress.Reporter, batchLabel string, commands []Runnable)
- func ReportBatchStarted(reporter progress.Reporter, label, batchType string)
- func ReportCommandStarted(reporter progress.Reporter, label string)
- func ReportExecutionComplete(ctx context.Context, reporter progress.Reporter, label string, results Results, ...)
- type BaseCommand
- func (c *BaseCommand) GetCwd() string
- func (c *BaseCommand) GetLabel() string
- func (c *BaseCommand) GetParent() Runnable
- func (c *BaseCommand) GetProgressReporter() progress.Reporter
- func (c *BaseCommand) GetType() string
- func (c *BaseCommand) InheritEnv(env map[string]string)
- func (c *BaseCommand) Run(_ context.Context) Results
- func (c *BaseCommand) SetParent(parent Runnable)
- func (c *BaseCommand) SetProgressReporter(reporter progress.Reporter)
- func (c *BaseCommand) ShouldRun(prev CommandStatus) ShouldRunAction
- type ChildReporter
- type CommandStatus
- type ErrFunctionCmdPanic
- type ForEachCommand
- type ForEachCwdStrategy
- type ForEachMode
- type FunctionCommand
- type FunctionCommandFunc
- type FunctionCommandReturn
- type ItemsProviderFunc
- type OSCommand
- type OutputOptions
- type ParallelBatch
- type Result
- type ResultStatus
- type Results
- func (r Results) HasError() bool
- func (r Results) Print() error
- func (r Results) PrintWithOptions(options *OutputOptions) error
- func (r Results) WriteBinary(w io.Writer) error
- func (r Results) WriteText(w io.Writer) error
- func (r Results) WriteTextWithOptions(w io.Writer, options *OutputOptions) error
- type RunCondition
- type Runnable
- type RunnableWithChildren
- type SerialBatch
- type ShouldRunAction
- type TransparentReporter
Examples ¶
Constants ¶
const ( // ItemEnvVar is the environment variable name used to store the current item in the iteration. ItemEnvVar = "ITEM" // ForEachCommandType is the type identifier for ForEachCommand runnables. ForEachCommandType = "ForEachCommand" )
const (
// FunctionCommandType is the type identifier for FunctionCommand runnables.
FunctionCommandType = "FunctionCommand"
)
const (
// OSCommandType is the type identifier for OSCommand runnables.
OSCommandType = "OSCommand"
)
const (
// ParallelBatchType is the type identifier for ParallelBatch runnables.
ParallelBatchType = "ParallelBatch"
)
const (
// SerialBatchType is the type identifier for SerialBatch runnables.
SerialBatchType = "SerialBatch"
)
const (
// TypeBaseCommand is the type identifier for BaseCommand.
TypeBaseCommand = "BaseCommand"
)
Variables ¶
var ( // ErrItemsProviderFailed is returned when the items provider function fails. ErrItemsProviderFailed = errors.New("items provider function failed") // ErrInvalidForEachMode is returned when an invalid foreach mode is specified. ErrInvalidForEachMode = errors.New("invalid foreach mode specified, must be 'serial' or 'parallel'") // ErrInvalidCwdStrategy is returned when an invalid cwd strategy is specified. ErrInvalidCwdStrategy = errors.New( "invalid cwd strategy specified, must be 'none', 'item_relative', or 'item_absolute'", ) )
var ( // ErrSkipIntentional is returned to intentionally skip the remaining batch execution. ErrSkipIntentional = errors.New("intentionally skip execution") // ErrSkipOnError is returned to intentionally skip the remaining batch execution. ErrSkipOnError = errors.New("skip execution due to previous error") )
var ( // ErrBufferOverflow is returned when the output exceeds the max size. ErrBufferOverflow = fmt.Errorf("output exceeds max size of %d bytes", maxBufferSize) // ErrCouldNotStartProcess is returned when the process could not be started. ErrCouldNotStartProcess = errors.New("could not start process") // ErrCouldNotKillProcess is returned when the process could not be killed. ErrCouldNotKillProcess = errors.New("could not kill process after timeout") // ErrFailedToReadBuffer is returned when the buffer from the operating system pipe could not be read. ErrFailedToReadBuffer = errors.New("failed to read buffer") // ErrTimeoutExceeded is returned when the command exceeds the context deadline. ErrTimeoutExceeded = errors.New("timeout exceeded") // ErrFailedToCreatePipe is returned when the operating system pipe could not be created. ErrFailedToCreatePipe = errors.New("failed to create pipe") // ErrSignalReceived is returned when a operating system signal is received by the child process. ErrSignalReceived = errors.New("signal received") // ErrDuplicateSignalReceived is returned when a duplicate signal is received, forcing process termination. ErrDuplicateSignalReceived = errors.New("duplicate signal received, process forcefully terminated") )
var ErrGobDecode = errors.New("gob decode error")
ErrGobDecode is the base error for gob decoding operations.
var ErrResultChildrenHasError = fmt.Errorf("result has children with errors")
ErrResultChildrenHasError is the error returned when a result has children with at least one error.
var ( // ErrRunConditionUnknown is returned when an unknown RunCondition value is encountered. ErrRunConditionUnknown = errors.New("unknown RunCondition value") )
var ErrSetCwd = errors.New("failed to set working directory, please check the path and permissions")
ErrSetCwd is returned when setting the working directory fails.
var ( // ErrWriteGob is returned when writing the results to a binary format fails. ErrWriteGob = errors.New("failed to write binary results") )
Functions ¶
func CreateChildReporterForBatch ¶ added in v0.0.7
CreateChildReporterForBatch creates a child reporter for batch operations. This consolidates the common pattern of creating child reporters with batch labels. If parent is nil, returns nil.
func NewErrFunctionCmdPanic ¶
NewErrFunctionCmdPanic creates a new ErrFunctionCmdPanic with the given value.
func PropagateReporterToChildren ¶ added in v0.2.4
PropagateReporterToChildren propagates a parent reporter to all child commands in a batch. This is extracted to avoid duplication between SerialBatch and ParallelBatch. If parent is nil, this is a no-op.
func ReportBatchStarted ¶ added in v0.0.7
ReportBatchStarted reports that a batch operation has started. If reporter is nil, this is a no-op.
func ReportCommandStarted ¶ added in v0.0.7
ReportCommandStarted reports that a command has started. If reporter is nil, this is a no-op.
func ReportExecutionComplete ¶ added in v0.0.7
func ReportExecutionComplete( ctx context.Context, reporter progress.Reporter, label string, results Results, successMsg, failureMsg string)
ReportExecutionComplete reports command/batch completion based on results. It handles both success and failure cases with appropriate event data. If reporter is nil, this is a no-op.
Types ¶
type BaseCommand ¶
type BaseCommand struct {
// Optional label for the command
Label string
// The condition under which the command runs
RunsOnCondition RunCondition
// Specific exit codes that trigger the command to run
RunsOnExitCodes []int
// Environment variables to be passed to the command
Env map[string]string
// contains filtered or unexported fields
}
BaseCommand is a struct that implements the Runnable interface. It should be embedded in other command types to provide common functionality.
func NewBaseCommand ¶
func NewBaseCommand( label, cwd string, runsOn RunCondition, runOnExitCodes []int, env map[string]string, ) *BaseCommand
NewBaseCommand creates a new BaseCommand with the specified parameters.
func (*BaseCommand) GetCwd ¶ added in v0.2.0
func (c *BaseCommand) GetCwd() string
GetCwd returns the current working directory for the command. It resolves the working directory using the following rules:
- If the receiver is nil, returns "."
- If cwd is empty and no parent exists, returns "."
- If cwd is empty and parent exists, inherits parent's cwd
- If cwd is absolute, returns it directly
- If cwd is relative and no parent exists, returns the relative path
- If cwd is relative and parent exists, joins it with parent's cwd
func (*BaseCommand) GetLabel ¶
func (c *BaseCommand) GetLabel() string
GetLabel returns the label of the command.
func (*BaseCommand) GetParent ¶
func (c *BaseCommand) GetParent() Runnable
GetParent returns the parent for this command or batch.
func (*BaseCommand) GetProgressReporter ¶ added in v0.2.4
func (c *BaseCommand) GetProgressReporter() progress.Reporter
GetProgressReporter returns the currently set progress reporter, or nil if none is set. This method is thread-safe.
func (*BaseCommand) GetType ¶ added in v0.2.5
func (c *BaseCommand) GetType() string
GetType return the type of the runnable.
func (*BaseCommand) InheritEnv ¶
func (c *BaseCommand) InheritEnv(env map[string]string)
InheritEnv sets additional environment variables for the command.
func (*BaseCommand) Run ¶ added in v0.2.0
func (c *BaseCommand) Run(_ context.Context) Results
Run does nothing, but is required to implement the Runnable interface. It should be overridden by concrete command types to provide actual functionality.
func (*BaseCommand) SetParent ¶
func (c *BaseCommand) SetParent(parent Runnable)
SetParent sets the parent for this command or batch.
func (*BaseCommand) SetProgressReporter ¶ added in v0.2.4
func (c *BaseCommand) SetProgressReporter(reporter progress.Reporter)
SetProgressReporter sets an optional progress reporter for real-time execution updates. If not set (nil), the command will run without progress reporting. This method is thread-safe but should be called before Run() for proper behavior.
func (*BaseCommand) ShouldRun ¶
func (c *BaseCommand) ShouldRun(prev CommandStatus) ShouldRunAction
ShouldRun checks if the command should run based on the current state. It returns a ShouldRunAction indicating whether to run, skip, or error.
type ChildReporter ¶ added in v0.0.7
type ChildReporter struct {
// contains filtered or unexported fields
}
ChildReporter creates a child progress reporter that prefixes command paths. This is used by progressive implementations to create nested progress reporting.
func NewChildReporter ¶ added in v0.0.7
func NewChildReporter(parent progress.Reporter, prefix []string) *ChildReporter
NewChildReporter creates a new child reporter with the given path prefix.
func (*ChildReporter) Close ¶ added in v0.0.7
func (cr *ChildReporter) Close()
Close implements Reporter by delegating to the parent.
func (*ChildReporter) Report ¶ added in v0.0.7
func (cr *ChildReporter) Report(event progress.Event)
Report implements ProgressReporter by correctly handling nested command paths.
type CommandStatus ¶ added in v0.2.6
type CommandStatus struct {
// State is the result status of the previous command.
State ResultStatus
// ExitCode is the exit code of the previous command.
ExitCode int
// Err is the error from the previous command, if any.
Err error
}
CommandStatus holds the state of the previous command execution.
type ErrFunctionCmdPanic ¶
type ErrFunctionCmdPanic struct {
// contains filtered or unexported fields
}
ErrFunctionCmdPanic is the error returned when a function command panics. It is constructed with the value that caused the panic.
func (*ErrFunctionCmdPanic) Error ¶
func (e *ErrFunctionCmdPanic) Error() string
Error implements the error interface for ErrFunctionCmdPanic.
type ForEachCommand ¶
type ForEachCommand struct {
*BaseCommand
// ItemsProvider is a function that returns a list of items to iterate over.
ItemsProvider ItemsProviderFunc
// Commands is the list of commands to execute for each item.
Commands []Runnable
// Mode determines how the commands are executed for each item.
Mode ForEachMode
// CwdStrategy is for modifying the current working directory for each item
CwdStrategy ForEachCwdStrategy
// ItemsSkipOnErrors is a list of errors that will not cause the foreach items provider to fail.
// Must be a list of errors that can be used with errors.Is.
ItemsSkipOnErrors []error
}
ForEachCommand executes a list of commands for each item returned by an items provider function.
func NewForEachCommand ¶
func NewForEachCommand( base *BaseCommand, provider ItemsProviderFunc, mode ForEachMode, commands []Runnable, ) *ForEachCommand
NewForEachCommand creates a new ForEachCommand.
func (*ForEachCommand) GetType ¶ added in v0.2.5
func (f *ForEachCommand) GetType() string
GetType returns the type of the runnable (e.g., "Command", "SerialBatch", "ParallelBatch", etc.).
type ForEachCwdStrategy ¶
type ForEachCwdStrategy int
ForEachCwdStrategy determines how the current working directory (cwd) is modified for each item.
const ( // CwdStrategyNone means no cwd modification. CwdStrategyNone ForEachCwdStrategy = iota // CwdStrategyItemRelative modifies the cwd to be relative to the item and // the working directory of the foreach command. CwdStrategyItemRelative )
func ParseCwdStrategy ¶
func ParseCwdStrategy(strategy string) (ForEachCwdStrategy, error)
ParseCwdStrategy converts a string to a ForEachCwdStrategy.
func (ForEachCwdStrategy) String ¶
func (s ForEachCwdStrategy) String() string
String implements the Stringer interface for ForEachCwdStrategy.
type ForEachMode ¶
type ForEachMode int
ForEachMode determines whether the commands are executed in serial or parallel.
const ( // ForEachSerial executes commands in series for each item. ForEachSerial ForEachMode = iota // ForEachParallel executes commands in parallel for each item. ForEachParallel )
func ParseForEachMode ¶
func ParseForEachMode(mode string) (ForEachMode, error)
ParseForEachMode converts a string to a ForEachMode. If the string is not valid, it returns an ErrInvalidForEachMode error.
func (ForEachMode) String ¶
func (m ForEachMode) String() string
type FunctionCommand ¶
type FunctionCommand struct {
*BaseCommand
Func FunctionCommandFunc // The function to run
}
FunctionCommand is a command that runs a function. It implements the Runnable interface.
func (*FunctionCommand) GetType ¶ added in v0.2.5
func (f *FunctionCommand) GetType() string
GetType returns the type of the runnable (e.g., "Command", "SerialBatch", "ParallelBatch", etc.).
type FunctionCommandFunc ¶
type FunctionCommandFunc func(ctx context.Context, workingDirectory string, args ...string) FunctionCommandReturn
FunctionCommandFunc is the type of the function that can be run by FunctionCommand. It takes a context, a string (the working directory), and a variadic number of strings (arguments).
type FunctionCommandReturn ¶
type FunctionCommandReturn struct {
NewCwd string // The new working directory, if changed
Err error // Any error that occurred during execution
}
FunctionCommandReturn is the return type of the function run by FunctionCommand.
type ItemsProviderFunc ¶
ItemsProviderFunc is a function that returns a list of items to iterate over. It takes a context and the current working directory, and returns a list of items and an error.
type OSCommand ¶
type OSCommand struct {
*BaseCommand
Args []string // Arguments to the command, do not include the executable name itself.
Path string // The command to run (e.g. executable full path).
SuccessExitCodes []int // Exit codes that indicate success, defaults to 0.
SkipExitCodes []int // Exit codes that indicate skip remaining tasks, defaults to empty.
// contains filtered or unexported fields
}
OSCommand represents a single command to be run in the batch.
func (*OSCommand) GetType ¶ added in v0.2.5
GetType returns the type of the runnable (e.g., "Command", "SerialBatch", "ParallelBatch", etc.).
func (*OSCommand) SetCleanup ¶
SetCleanup sets the cleanup function to be called after the command finishes.
type OutputOptions ¶
type OutputOptions struct {
IncludeStdOut bool // Whether to include stdout in the output
IncludeStdErr bool // Whether to include stderr in the output
ShowSuccessDetails bool // Whether to show details for successful commands
ShowDetails bool // Whether to show the working directory in the output
}
OutputOptions controls what is included in the output.
func DefaultOutputOptions ¶
func DefaultOutputOptions() *OutputOptions
DefaultOutputOptions returns a default set of output options.
type ParallelBatch ¶
type ParallelBatch struct {
*BaseCommand
Commands []Runnable // The commands or nested batches to run
}
ParallelBatch represents a collection of commands, which can be run in parallel.
func (*ParallelBatch) GetType ¶ added in v0.2.5
func (b *ParallelBatch) GetType() string
GetType returns the type of the runnable (e.g., "Command", "SerialBatch", "ParallelBatch", etc.).
func (*ParallelBatch) Run ¶
func (b *ParallelBatch) Run(ctx context.Context) Results
Run implements the Runnable interface for ParallelBatch.
func (*ParallelBatch) SetProgressReporter ¶ added in v0.2.4
func (b *ParallelBatch) SetProgressReporter(reporter progress.Reporter)
SetProgressReporter sets the progress reporter and propagates it to all child commands.
type Result ¶
type Result struct {
// Exit code of the command or batch.
ExitCode int
// Error, if any.
Error error
// The status of the result, e.g. success, error, skipped.
// The Default is ResultStatusUnknown, so always ensure to set this to something meaningful.
Status ResultStatus
// Output from the command(s).
StdOut []byte
// Error output from the command(s).
StdErr []byte
// Label of the command or batch.
Label string
// Nested results for tree output.
Children Results
// The working directory at the time of execution
Cwd string
// The type of the runnable that produced this result
Type string
// contains filtered or unexported fields
}
Result represents the outcome of running a command or batch.
type ResultStatus ¶
type ResultStatus int
ResultStatus summarizes the status of a command or batch result.
const ( // ResultStatusUnknown indicates the result status is unknown. ResultStatusUnknown ResultStatus = iota // ResultStatusSuccess indicates the command or batch completed successfully. ResultStatusSuccess // ResultStatusSkipped indicates the command or batch was skipped. ResultStatusSkipped // ResultStatusWarning indicates the command or batch completed with warnings. ResultStatusWarning // ResultStatusError indicates the command or batch failed. ResultStatusError )
func (ResultStatus) String ¶
func (rs ResultStatus) String() string
String implements the Stringer interface for ResultStatus.
type Results ¶
type Results []*Result
Results is a slice of Result pointers, used to represent multiple results.
func (Results) HasError ¶
HasError if any of the results in the hierarchy has an error or non-zero exit code.
func (Results) PrintWithOptions ¶
func (r Results) PrintWithOptions(options *OutputOptions) error
PrintWithOptions outputs the results to stdout with the specified options.
func (Results) WriteBinary ¶
WriteBinary outputs the results to the specified writer in binary format using gob encoding.
func (Results) WriteText ¶
WriteText outputs the results to the specified writer with default options.
func (Results) WriteTextWithOptions ¶
func (r Results) WriteTextWithOptions(w io.Writer, options *OutputOptions) error
WriteTextWithOptions outputs the results to the specified writer with the specified options.
Example (StderrOutput) ¶
ExampleWriteResults_stderrOutput demonstrates how to format stderr output with the result formatter.
// Create a sample result hierarchy with stderr output
cmdWithStderr := &Result{
Label: "Command with StdErr",
ExitCode: 1,
Error: fmt.Errorf("command failed with output error"),
StdErr: []byte("Error message line 1\nError message line 2\n Indented error line\nAnother error line"),
Status: ResultStatusError,
}
nestedCmd := &Result{
Label: "Nested Command with StdErr",
ExitCode: 2,
Error: fmt.Errorf("nested command timed out"),
StdErr: []byte("Nested error 1\nNested error 2"),
Status: ResultStatusError,
}
// Create a parent result that contains both commands
parentResult := &Result{
Label: "Parent Batch",
ExitCode: -1,
Error: ErrResultChildrenHasError,
Children: Results{cmdWithStderr, nestedCmd},
Status: ResultStatusError,
}
results := Results{parentResult}
// Create a string writer for the example output
var buf strings.Builder
// Create options that show stderr and use plain text (no colors) for example output
options := &OutputOptions{
IncludeStdOut: false,
IncludeStdErr: true,
ShowSuccessDetails: false,
}
// Write the results to the buffer
_ = results.WriteTextWithOptions(&buf, options)
// For the example, print to stdout
fmt.Println(buf.String())
Output: ✗ Parent Batch (exit code: -1) ✗ Command with StdErr (exit code: 1) ➜ Error: command failed with output error ➜ Error Output: Error message line 1 Error message line 2 Indented error line Another error line ✗ Nested Command with StdErr (exit code: 2) ➜ Error: nested command timed out ➜ Error Output: Nested error 1 Nested error 2
type RunCondition ¶
type RunCondition int
RunCondition defines when a command should run based on the result of the previous command. It can be set to RunOnSuccess, RunOnError, or RunOnAlways.
const ( // RunOnSuccess means the command runs only if the previous command succeeded (exit code 0). RunOnSuccess RunCondition = iota // RunOnError means the command runs only if the previous command failed (non-zero exit code) or error occurred. RunOnError // RunOnAlways means the command always runs regardless of the previous command's result. RunOnAlways // RunOnExitCodes means the command runs only if the previous command's exit code matches one of the specified codes. RunOnExitCodes )
func NewRunCondition ¶
func NewRunCondition(s string) (RunCondition, error)
NewRunCondition creates a RunCondition from a string.
func (RunCondition) String ¶
func (r RunCondition) String() string
String returns the string representation of the RunCondition.
type Runnable ¶
type Runnable interface {
// Run executes the command or batch and returns the results.
// It should handle context cancellation and passing signals to any spawned process.
Run(context.Context) Results
// GetCwd returns the current working directory for the command or batch.
GetCwd() string
// InheritEnv sets the environment variables for the command or batch.
// It should not overwrite the existing environment variables, but rather add to them.
InheritEnv(map[string]string)
// GetLabel returns the label or description of the command or batch.
GetLabel() string
// GetParent returns the parent for this command or batch.
GetParent() Runnable
// SetParent sets the parent for this command or batch.
SetParent(Runnable)
// ShouldRun returns true if the command or batch should be run.
ShouldRun(state CommandStatus) ShouldRunAction
// SetProgressReporter sets an optional progress reporter for real-time execution updates.
// If not set (nil), the command will run without progress reporting.
// This method is thread-safe but should be called before Run() for proper behavior.
SetProgressReporter(reporter progress.Reporter)
// GetProgressReporter returns the currently set progress reporter, or nil if none is set.
// This method is thread-safe.
GetProgressReporter() progress.Reporter
// GetType returns the type of the runnable (e.g., "Command", "SerialBatch", "ParallelBatch", etc.).
GetType() string
}
Runnable is an interface for something that can be run as part of a batch (either a Command or a nested Batch).
type RunnableWithChildren ¶ added in v0.2.0
type RunnableWithChildren interface {
// GetChildren returns the child commands or batches of this runnable.
GetChildren() []Runnable
}
RunnableWithChildren is an interface for runnables that can have child commands or batches.
type SerialBatch ¶
type SerialBatch struct {
*BaseCommand
Commands []Runnable // The commands or nested batches to run
}
SerialBatch represents a collection of commands, which are run serially.
func (*SerialBatch) GetType ¶ added in v0.2.5
func (b *SerialBatch) GetType() string
GetType returns the type of the runnable.
func (*SerialBatch) Run ¶
func (b *SerialBatch) Run(ctx context.Context) Results
Run implements the Runnable interface for SerialBatch.
func (*SerialBatch) SetProgressReporter ¶ added in v0.2.4
func (b *SerialBatch) SetProgressReporter(reporter progress.Reporter)
SetProgressReporter sets the progress reporter and propagates it to all child commands.
type ShouldRunAction ¶
type ShouldRunAction int
ShouldRunAction defines the action to take based on the result of a command's pre-check.
const ( // ShouldRunActionRun means run the command. ShouldRunActionRun ShouldRunAction = iota // ShouldRunActionSkip means skip the command. ShouldRunActionSkip // ShouldRunActionError means an error occurred, do not run the command. ShouldRunActionError )
type TransparentReporter ¶ added in v0.0.7
type TransparentReporter struct {
// contains filtered or unexported fields
}
TransparentReporter is a reporter that passes events through without modifying the command path. This is useful for intermediate commands that should not appear in the progress hierarchy, such as ForEachCommand which creates a batch internally.
func NewTransparentReporter ¶ added in v0.0.7
func NewTransparentReporter(parent progress.Reporter) *TransparentReporter
NewTransparentReporter creates a new transparent reporter that passes events through to the parent without adding any command path prefixes.
func (*TransparentReporter) Close ¶ added in v0.0.7
func (tr *TransparentReporter) Close()
Close implements Reporter by delegating to the parent.
func (*TransparentReporter) Report ¶ added in v0.0.7
func (tr *TransparentReporter) Report(event progress.Event)
Report implements ProgressReporter by passing the event through unchanged.