shell

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package shell provides fake implementations of shell-related interfaces for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Shell)

Option defines a function type for configuring the Shell instance.

func WithDuration

func WithDuration(d time.Duration) Option

WithDuration sets the simulated execution duration for commands.

func WithResponse

func WithResponse(
	cmd command.Command,
	res proc.Execution,
) Option

WithResponse sets a predefined response for a specific command.

Parameters:

  • cmd: The command for which the response is to be set.
  • res: The execution result to be returned when the command is executed.

type Shell

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

Shell is a fake implementation of the Shell interface for testing purposes.

func NewShell

func NewShell(opts ...Option) *Shell

NewShell creates and returns a new Shell instance to execute system commands.

func (*Shell) Execution

func (s *Shell) Execution(
	ctx context.Context,
	cmd command.Command,
) proc.Execution

Execution executes the given command and returns its execution result.

Jump to

Keyboard shortcuts

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