shell

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package shell provides gbash's project-owned shell core plus the in-tree parser, expansion, and interpreter packages it executes against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

func IsExitStatus

func IsExitStatus(err error) bool

func IsUserSyntaxError added in v0.0.20

func IsUserSyntaxError(err error) bool

IsUserSyntaxError reports whether err is a user-facing shell syntax error suitable for REPL and fuzz-test classification.

Types

type Execution

type Execution struct {
	Name              string
	Interpreter       string
	PassthroughArgs   []string
	ScriptPath        string
	Script            string
	Command           []string
	Args              []string
	StartupOptions    []string
	StartupHome       string
	Interactive       bool
	Env               map[string]string
	Dir               string
	VisiblePWD        string
	HasVisiblePWD     bool
	BuiltinCommandDir string
	CompletionState   *shellstate.CompletionState
	Stdin             io.Reader
	Stdout            io.Writer
	Stderr            io.Writer
	FS                gbfs.FileSystem
	Network           network.Client
	Registry          commands.CommandRegistry
	Policy            policy.Policy
	Trace             trace.Recorder
	Exec              func(context.Context, *commands.ExecutionRequest) (*commands.ExecutionResult, error)
	Interact          func(context.Context, *commands.InteractiveRequest) (*commands.InteractiveResult, error)
	// contains filtered or unexported fields
}

type InteractiveParser added in v0.0.20

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

InteractiveParser is the shell-owned frontend helper for interactive parsing. It assembles complete script chunks for REPL-style callers, but it does not execute them or provide a second shell engine.

func NewInteractiveParser added in v0.0.20

func NewInteractiveParser(name string) *InteractiveParser

NewInteractiveParser builds the shell-owned parser/printer pair used by repo REPL frontends and tests.

func (*InteractiveParser) Incomplete added in v0.0.20

func (p *InteractiveParser) Incomplete() bool

Incomplete reports whether the most recent interactive parse needs a continuation line.

func (*InteractiveParser) Seq added in v0.0.20

Seq parses interactive input and yields rendered script chunks ready for execution.

type InteractiveResult

type InteractiveResult struct {
	ExitCode int
}

func Interact added in v0.0.20

func Interact(ctx context.Context, exec *Execution) (*InteractiveResult, error)

type RunResult

type RunResult struct {
	FinalEnv    map[string]string
	ShellExited bool
}

func Run added in v0.0.20

func Run(ctx context.Context, exec *Execution) (*RunResult, error)

func RunCommand added in v0.0.20

func RunCommand(ctx context.Context, exec *Execution) (*RunResult, error)

Directories

Path Synopsis
Package expand contains code to perform various shell expansions.
Package expand contains code to perform various shell expansions.
Package fileutil allows inspecting shell files, such as detecting whether a file may be shell or extracting its shebang.
Package fileutil allows inspecting shell files, such as detecting whether a file may be shell or extracting its shebang.
Package interp implements an interpreter to execute shell programs parsed by the syntax package.
Package interp implements an interpreter to execute shell programs parsed by the syntax package.
Package pattern allows working with shell pattern matching notation, also known as wildcards or globbing.
Package pattern allows working with shell pattern matching notation, also known as wildcards or globbing.
Package syntax implements parsing and formatting of shell programs.
Package syntax implements parsing and formatting of shell programs.
typedjson
Package typedjson allows encoding and decoding shell syntax trees as JSON.
Package typedjson allows encoding and decoding shell syntax trees as JSON.

Jump to

Keyboard shortcuts

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