command

package
v0.0.0-...-d03d53d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgumentBuilder

type ArgumentBuilder struct {
	Builder
	Compressed   bool
	WithMetadata bool
	// contains filtered or unexported fields
}

func (*ArgumentBuilder) GetCommand

func (b *ArgumentBuilder) GetCommand(p delivery.Properties, d delivery.Info, body []byte) (*exec.Cmd, error)

func (*ArgumentBuilder) SetCaptureOutput

func (b *ArgumentBuilder) SetCaptureOutput(capture bool)

func (*ArgumentBuilder) SetCommand

func (b *ArgumentBuilder) SetCommand(cmd string)

func (*ArgumentBuilder) SetErrorWriter

func (b *ArgumentBuilder) SetErrorWriter(w io.Writer)

func (*ArgumentBuilder) SetLogger

func (b *ArgumentBuilder) SetLogger(l logr.Logger)

SetLogger is part of Builder.

func (*ArgumentBuilder) SetOutputWriter

func (b *ArgumentBuilder) SetOutputWriter(w io.Writer)

type Builder

type Builder interface {
	// SetLogger sets the logger passed to the command used while building.
	SetLogger(l logr.Logger)

	// SetOutputWriter sets the writer used for capturing the commands STDOUT when capturing is enabled.
	SetOutputWriter(w io.Writer)

	// SetErrorWriter sets the writer used for capturing the commands STDERR when capturing is enabled.
	SetErrorWriter(lw io.Writer)

	// SetCaptureOutput enables/disables output capturing of the command.
	SetCaptureOutput(captrue bool)

	// SetCommand sets the command to be executed for each received message.
	SetCommand(cmd string)

	// GetCommand gets the executable command for the given message data.
	GetCommand(p delivery.Properties, d delivery.Info, body []byte) (*exec.Cmd, error)
}

Builder describes the interface used to build the command to be executed for a received message.

func NewBuilder

func NewBuilder(b Builder, cmd string, capture bool, l logr.Logger, infoW, errW io.Writer) (Builder, error)

NewBuilder ensures a builder struct is setup and ready to be used.

type LogWriter

type LogWriter struct {
	io.Writer
	Logger *log.Logger
}

func NewLogWriter

func NewLogWriter(l *log.Logger) *LogWriter

func (LogWriter) Write

func (lw LogWriter) Write(b []byte) (n int, err error)

type PipeBuilder

type PipeBuilder struct {
	Builder
	WithMetadata bool
	// contains filtered or unexported fields
}

func (*PipeBuilder) GetCommand

func (b *PipeBuilder) GetCommand(p delivery.Properties, d delivery.Info, body []byte) (*exec.Cmd, error)

func (*PipeBuilder) SetCaptureOutput

func (b *PipeBuilder) SetCaptureOutput(capture bool)

func (*PipeBuilder) SetCommand

func (b *PipeBuilder) SetCommand(cmd string)

func (*PipeBuilder) SetErrorWriter

func (b *PipeBuilder) SetErrorWriter(w io.Writer)

func (*PipeBuilder) SetLogger

func (b *PipeBuilder) SetLogger(l logr.Logger)

SetLogger is part of Builder.

func (*PipeBuilder) SetOutputWriter

func (b *PipeBuilder) SetOutputWriter(w io.Writer)

Jump to

Keyboard shortcuts

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