Documentation
¶
Overview ¶
Package shcoreutils provides a middleware for the mvdan/sh interpreter that runs the core utils commands of charm.land/turtle/coreutils.
This is particularly useful to keep the max compability on Windows where these core utils are not available, unless when installed manually by the user.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) func(interp.ExecHandlerFunc) interp.ExecHandlerFunc
New returns an interp.ExecHandlerFunc middleware configured with opts. It handles the core utils commands, excluding those shadowed by interpreter builtins. Use WithPriority to prefer the system implementations.
Utilities which invoke other programs resolve those names through the same table, and run external programs through the remaining handler chain with the requested directory, environment, and streams.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error wraps an error returned from a core utility, carrying its exit status.
type Option ¶
type Option func(*config)
Option configures the middleware returned by New.
func WithPriority ¶
WithPriority sets which implementation runs when both are available.
type Priority ¶
type Priority uint8
Priority decides whether a command in the table runs as a Turtle utility or as the system executable.
const ( // PriorityTurtle runs the Turtle implementations, shadowing the system // ones. It's the default. PriorityTurtle Priority = iota // PrioritySystem runs the system utility when it resolves in the PATH of // the command, falling back to Turtle otherwise. PrioritySystem // PriorityAuto runs Turtle on Windows, and the system utilities // elsewhere. PriorityAuto )