command

package
v0.0.0-...-9efb58e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BB

func BB(s string) (b []byte)

func CreateDirectory

func CreateDirectory(dir string) bool

func CreateDirectoryWithFileInfo

func CreateDirectoryWithFileInfo(dir string) os.FileInfo

func PrintLogs

func PrintLogs(_logs []string)

func Run

func Run(ctx context.Context, bufferSize, retries int) error

Types

type Command

type Command struct {
	Command   string
	Cmd       *exec.Cmd
	Stdin     []byte
	Stdout    []byte
	Stderr    []byte
	ExecError error
}

type CommandOutput

type CommandOutput struct {
	Command string
	Runtime time.Duration
	Stdout  []byte
	Stderr  []byte
	Error   error
}

type Commander

type Commander struct {
	Commands []Command
	Stdout   []byte
	Stderr   []byte
}

func (*Commander) Compile

func (cmd *Commander) Compile(command string) *exec.Cmd

func (*Commander) Pipe

func (cmd *Commander) Pipe(ctx context.Context, commands []UnsafeRawCommand, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*Commander) Run

func (cmd *Commander) Run(ctx context.Context, rawCommand UnsafeRawCommand, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*Commander) RunInside

func (cmd *Commander) RunInside(ctx context.Context, rawCommand UnsafeRawCommand, directory string, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*Commander) RunInsideWithInput

func (cmd *Commander) RunInsideWithInput(ctx context.Context, rawCommand UnsafeRawCommand, directory string, input string, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*Commander) String

func (cmd *Commander) String() string

type CtxKeyPipeRawCommand

type CtxKeyPipeRawCommand string

type LineWriter

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

func NewLineWriter

func NewLineWriter(size int) *LineWriter

func (*LineWriter) Close

func (lw *LineWriter) Close()

func (*LineWriter) Err

func (lw *LineWriter) Err() error

func (*LineWriter) Lines

func (lw *LineWriter) Lines() <-chan string

func (*LineWriter) ReadLine

func (lw *LineWriter) ReadLine() (string, error)

func (*LineWriter) Write

func (lw *LineWriter) Write(p []byte) (n int, err error)

type PromptHistory

type PromptHistory struct {
	Commands []string
	Runtimes []time.Duration
	Outputs  [][]byte
	// contains filtered or unexported fields
}

func Prompt

func Prompt() *PromptHistory

func (*PromptHistory) AddCommand

func (p *PromptHistory) AddCommand(rawCmd UnsafeRawCommand)

func (*PromptHistory) AddRuntime

func (p *PromptHistory) AddRuntime(dur time.Duration)

func (*PromptHistory) AddStdout

func (p *PromptHistory) AddStdout(stdout []byte)

func (*PromptHistory) Run

func (p *PromptHistory) Run(ctx context.Context, rawCmd string, sem sema.Semaphore, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*PromptHistory) RunInside

func (p *PromptHistory) RunInside(ctx context.Context, rawCmd string, sem sema.Semaphore, directory string, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*PromptHistory) RunInsideWithInput

func (p *PromptHistory) RunInsideWithInput(ctx context.Context, rawCmd string, sem sema.Semaphore, directory string, input string, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*PromptHistory) RunWithInput

func (p *PromptHistory) RunWithInput(ctx context.Context, rawCmd string, rawInput string, env []string, handler func(CommandOutput) bool) (CommandOutput, bool)

func (*PromptHistory) String

func (p *PromptHistory) String() (out string)

func (*PromptHistory) TraceIt

func (p *PromptHistory) TraceIt(command string) (err error)

type UnsafeRawCommand

type UnsafeRawCommand string

Jump to

Keyboard shortcuts

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