shell

package
v0.0.0-...-226a73d Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package shell adapts the coreutils tool registry to mvdan.cc/sh/v3 so any embedding shell exposes the whole pure-Go userland as in-process commands. The adapter is an interp.ExecHandler middleware: argv[0] that names a registered tool runs via tool.Run (no process spawned, no PATH lookup); anything else falls through to the next handler.

Precedence is pure-Go first — uniformity across Linux/macOS/Windows is the product. A host that wants the opposite (defer to system binaries, e.g. a strict GNU-bash drop-in) simply does not wire this middleware.

This package imports sh; sh never imports coreutils. The core `tool` package stays sh-free — only this adapter and its consumers pull sh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

Handler returns an interp.ExecHandler middleware that intercepts every registered tool. Wire it via interp.ExecHandlers(shell.Handler()) — or, for a persistent runner, append it to the middleware chain before the default exec handler.

func HandlerFunc

func HandlerFunc(intercept func(name string) bool) func(interp.ExecHandlerFunc) interp.ExecHandlerFunc

HandlerFunc is like Handler but takes an optional predicate deciding whether argv[0] should be served from the registry. A nil predicate intercepts every registered tool. Use a predicate to carve out names a host wants to keep routing to PATH (e.g. allow only the agentic `yc` verbs while leaving file/text tools to the system).

Types

This section is empty.

Jump to

Keyboard shortcuts

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