Documentation
¶
Index ¶
Constants ¶
const DefaultCoreutils = CoreutilsAuto
DefaultCoreutils is the mode used when neither the Taskfile nor the environment selects one.
Variables ¶
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
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
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.