commandexectest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler func(name string, args ...string) ([]byte, error)

CommandHandler represents a function that handles a specific command

type Executor

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

Executor implements commandexec.Executor for testing

func NewExecutor

func NewExecutor() *Executor

func (*Executor) AddBinary

func (e *Executor) AddBinary(name, path string)

AddBinary registers a binary name that LookPath should resolve.

func (*Executor) AddHandler

func (e *Executor) AddHandler(fullCommand string, handler CommandHandler)

AddHandler registers a handler for a specific full command string

func (*Executor) Exec

func (e *Executor) Exec(name string, args ...string) ([]byte, error)

Exec executes the command by looking up the registered handler.

func (*Executor) LookPath

func (e *Executor) LookPath(file string) (string, error)

LookPath simulates exec.LookPath; it returns the registered binary path.

Jump to

Keyboard shortcuts

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