Documentation
¶
Index ¶
- func IsCommandNotFound(err error) bool
- type CommandNotFoundError
- type Executor
- func (e *Executor) Environ() []string
- func (e *Executor) Execute(ctx context.Context, command string, stdout, stderr io.Writer) (*Result, error)
- func (e *Executor) Functions() []string
- func (e *Executor) GetRunner() *interp.Runner
- func (e *Executor) Reset()
- func (e *Executor) SetCaptureLimit(limit int64)
- func (e *Executor) SetExportedEnv(name, value string)
- func (e *Executor) SetPositionalArgs(args []string)
- func (e *Executor) SetProgressEnabled(enabled bool)
- func (e *Executor) SetProgressThreshold(d time.Duration)
- func (e *Executor) SetShellName(name string)
- func (e *Executor) ShellName() string
- func (e *Executor) ShellPath() string
- func (e *Executor) SyncRunnerDir()
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCommandNotFound ¶
IsCommandNotFound checks if an error is a CommandNotFoundError.
Types ¶
type CommandNotFoundError ¶
type CommandNotFoundError struct {
Command string
}
CommandNotFoundError is returned when a command doesn't exist in PATH.
func (*CommandNotFoundError) Error ¶
func (e *CommandNotFoundError) Error() string
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor runs shell commands using mvdan/sh interpreter.
func (*Executor) Environ ¶
Environ returns all environment variables in "NAME=value" format. This is used for tab-completion of environment variables.
func (*Executor) Execute ¶
func (e *Executor) Execute(ctx context.Context, command string, stdout, stderr io.Writer) (*Result, error)
Execute runs a command using the mvdan/sh interpreter.
func (*Executor) Functions ¶
Functions returns the names of all tracked user-defined functions. This is used for tab-completion of aliases and functions.
func (*Executor) Reset ¶
func (e *Executor) Reset()
Reset clears the interpreter state, including all function definitions. The runner will be recreated on the next Execute() call.
func (*Executor) SetCaptureLimit ¶
SetCaptureLimit sets the maximum number of bytes to capture. Use a negative value for unlimited capture, or 0 to disable capture.
func (*Executor) SetExportedEnv ¶
SetExportedEnv sets an exported environment variable for the shell session.
func (*Executor) SetPositionalArgs ¶
SetPositionalArgs sets $0, $1, $2, etc. for script execution. These are used when creating the interpreter for -c command execution.
func (*Executor) SetProgressEnabled ¶
SetProgressEnabled enables or disables progress bar.
func (*Executor) SetProgressThreshold ¶
SetProgressThreshold sets how long to wait before showing progress.
func (*Executor) SetShellName ¶
SetShellName sets the shell name for $0.
func (*Executor) SyncRunnerDir ¶
func (e *Executor) SyncRunnerDir()
SyncRunnerDir syncs the persistent runner's working directory with the process. Call this after changing directory via os.Chdir() (e.g., after builtin cd).