execext

package
v3.55.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultCoreutils = CoreutilsAuto

DefaultCoreutils is the mode used when neither the Taskfile nor the environment selects one.

Variables

View Source
var ErrNilOptions = errors.New("execext: nil options given")

ErrNilOptions is returned when a nil options is given

Functions

func ExpandFields added in v3.43.0

func ExpandFields(s string) ([]string, error)

ExpandFields is a wrapper around expand.Fields. It will escape the input string, expand any shell symbols (such as '~') and resolve any environment variables. It also expands brace expressions ({a.b}) and globs (*/**) and returns the results as a list of strings.

func ExpandLiteral added in v3.43.0

func ExpandLiteral(s string) (string, error)

ExpandLiteral is a wrapper around expand.Literal. It will escape the input string, expand any shell symbols (such as '~') and resolve any environment variables.

func RunCommand

func RunCommand(ctx context.Context, opts *RunCommandOptions) error

RunCommand runs a shell command

Types

type CoreutilsMode added in v3.55.0

type CoreutilsMode string

CoreutilsMode selects how the core utilities run in Task's shell.

const (
	// CoreutilsTurtle always uses the charm.land/turtle implementations.
	CoreutilsTurtle CoreutilsMode = "turtle"
	// CoreutilsSystem prefers the system utilities, falling back to Turtle
	// when one is not found in PATH.
	CoreutilsSystem CoreutilsMode = "system"
	// CoreutilsAuto uses Turtle on Windows and the system utilities
	// elsewhere.
	CoreutilsAuto CoreutilsMode = "auto"
	// CoreutilsOff skips the coreutils middleware entirely.
	CoreutilsOff CoreutilsMode = "off"
)

func CoreutilsFromEnv added in v3.55.0

func CoreutilsFromEnv() (CoreutilsMode, bool)

CoreutilsFromEnv returns the mode set in the environment, reporting whether one was selected. TASK_COREUTILS is checked first, with the legacy TASK_CORE_UTILS as a fallback. Both accept a mode name or, for backward compatibility, a boolean: true maps to turtle and false to system. Values that are neither are ignored so the remaining fallbacks apply.

func ParseCoreutilsMode added in v3.55.0

func ParseCoreutilsMode(value string) (CoreutilsMode, error)

ParseCoreutilsMode returns the mode named by value, or an error naming the valid ones. An empty value means the default.

func ResolveCoreutils added in v3.55.0

func ResolveCoreutils(taskrcValue string) (CoreutilsMode, error)

ResolveCoreutils returns the mode set in the environment, falling back to the taskrc value and then the default.

type RunCommandOptions

type RunCommandOptions struct {
	Command   string
	Dir       string
	Env       []string
	PosixOpts []string
	BashOpts  []string
	Stdin     io.Reader
	Stdout    io.Writer
	Stderr    io.Writer
	// Coreutils selects how the core utilities run. The zero value falls
	// back to the environment and then the default.
	Coreutils CoreutilsMode
}

RunCommandOptions is the options for the RunCommand func.

Jump to

Keyboard shortcuts

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