mach

package module
v0.0.0-...-bcad7d8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 9 Imported by: 0

README

mach

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByLine

func ByLine(in io.Reader, fn func([]byte) error) error

The slice passed to fn is only valid for the call of the function!

Types

type Filter

type Filter func([]byte) (bool, error)

func (Filter) Run

func (f Filter) Run(ctx context.Context, in io.Reader, out io.Writer) error

type Runnable

type Runnable interface {
	// Run the command with the provided in and out streams. Errors will be written to out.
	Run(ctx context.Context, in io.Reader, out io.Writer) error
}

type RunnableFunc

type RunnableFunc func(ctx context.Context, in io.Reader, out io.Writer) error

func (RunnableFunc) Run

func (r RunnableFunc) Run(ctx context.Context, in io.Reader, out io.Writer) error

type Runner

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

func NewRunner

func NewRunner(rr Runnable) *Runner

func Run

func Run(r string) *Runner

func Shell

func Shell(expr string) *Runner

func (*Runner) Go

func (r *Runner) Go()

Go executes the pipeline using os.Stdin and os.Stdout. Errors will be written to out.

func (*Runner) GoCtx

func (r *Runner) GoCtx(ctx context.Context)

func (*Runner) Pipe

func (r *Runner) Pipe(rr Runnable) *Runner

Pipe the result of the previous step into this step.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, in io.Reader, out io.Writer) error

func (*Runner) RunBytes

func (r *Runner) RunBytes(ctx context.Context, in io.Reader) ([]byte, error)

RunBytes executes the pipeline with the provided in streams and return a byte slice with the result. Any error will be returned as the error of this call.

func (*Runner) RunString

func (r *Runner) RunString(ctx context.Context, in io.Reader) (string, error)

RunString exexutes the pipeline with the provided in streams and return a string with the result. Any error will be returned as the error of this call.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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