command

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DepsInstalled

func DepsInstalled(c Commander, deps ...string) error

func FormatCommand

func FormatCommand(cmd string, options *Options) string

func WithStderr

func WithStderr(w io.Writer) func(*DefaultCommander)

func WithStdout

func WithStdout(w io.Writer) func(*DefaultCommander)

func WithVerboseWriter

func WithVerboseWriter(w io.Writer) func(*DefaultCommander)

Types

type Commander

type Commander interface {
	Execute(cmd string, opts ...Option) ([]byte, error)
}

func NewCommander

func NewCommander(options ...func(*DefaultCommander)) Commander

type DefaultCommander

type DefaultCommander struct {
	Stdout        io.Writer
	Stderr        io.Writer
	VerboseWriter io.Writer
}

func (*DefaultCommander) Execute

func (c *DefaultCommander) Execute(cmd string, opts ...Option) ([]byte, error)

type Option

type Option func(*Options)

func WithArgs

func WithArgs(args ...string) Option

func WithEnv

func WithEnv(env map[string]string) Option

func WithOverrideStdout

func WithOverrideStdout(w io.Writer) Option

type Options

type Options struct {
	Env    map[string]string
	Args   []string
	Stdout io.Writer
}

func ApplyOptions

func ApplyOptions(opts []Option) *Options

Jump to

Keyboard shortcuts

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