shell

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v0.1.19

func Command(spec Spec) *exec.Cmd

Command creates an exec.Cmd from a resolved shell spec.

func ConfigureCommand

func ConfigureCommand(cmd *exec.Cmd)

ConfigureCommand applies platform process settings for shell commands.

func RunCommand added in v0.1.14

func RunCommand(ctx context.Context, cmd *exec.Cmd) error

Types

type CommandCleanup added in v0.1.21

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

func AttachCommandCleanup added in v0.1.21

func AttachCommandCleanup(cmd *exec.Cmd) *CommandCleanup

func (*CommandCleanup) Cleanup added in v0.1.21

func (c *CommandCleanup) Cleanup() error

type Kind

type Kind string

Kind identifies the command language a resolved shell expects.

const (
	KindPOSIX      Kind = "posix"
	KindPowerShell Kind = "powershell"
	KindCmd        Kind = "cmd"
)

type LookPathFunc

type LookPathFunc func(file string) (string, error)

LookPathFunc matches exec.LookPath and allows tests to control discovery.

type Resolver

type Resolver struct {
	GOOS     string
	LookPath LookPathFunc
	Env      []string
}

Resolver resolves shell commands for a target platform.

func (Resolver) DescribeRuntime

func (r Resolver) DescribeRuntime() RuntimeDescription

DescribeRuntime describes the resolver's shell runtime.

func (Resolver) Resolve

func (r Resolver) Resolve(command string) (Spec, error)

Resolve returns the shell command specification for the resolver platform.

type RuntimeDescription

type RuntimeDescription struct {
	GOOS string
	Spec Spec
}

RuntimeDescription describes the shell language the current runtime expects.

func DescribeRuntime

func DescribeRuntime() RuntimeDescription

DescribeRuntime describes the current host shell runtime.

func (RuntimeDescription) CommandGuidance

func (d RuntimeDescription) CommandGuidance() string

CommandGuidance returns model-facing command-language guidance for shell_run.

func (RuntimeDescription) ShellSummary

func (d RuntimeDescription) ShellSummary() string

ShellSummary returns a compact user-facing shell execution summary.

func (RuntimeDescription) ToolGuidance

func (d RuntimeDescription) ToolGuidance() string

ToolGuidance returns a compact sentence suitable for a tool description.

type Spec

type Spec struct {
	Kind        Kind
	DisplayName string
	Bin         string
	Args        []string
}

Spec describes the executable and arguments used to run a shell command.

func Resolve

func Resolve(command string) (Spec, error)

Resolve returns the shell command specification for the current platform.

Jump to

Keyboard shortcuts

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