package task
import "cuelang.org/go/internal/task"
Package task provides a registry for tasks to be used by commands.
Index ¶
- Variables
- func Register(key string, f RunnerFunc)
- type Context
- func (c *Context) Bytes(field string) []byte
- func (c *Context) Int64(field string) int64
- func (c *Context) Lookup(field string) cue.Value
- func (c *Context) String(field string) string
- func (c Context) TaskFunc(didWork *atomic.Bool) flow.TaskFunc
- type Runner
- type RunnerFunc
Variables ¶
ErrLegacy is a sentinel error value that may be returned by a TaskKey function to indicate that the task is a legacy task. This will cause the configuration value to be passed to the RunnerFunc instead of an empty value.
Functions ¶
func Register ¶
func Register(key string, f RunnerFunc)
Register registers a task for cue commands.
Types ¶
type Context ¶
type Context struct {
Context context.Context
TaskKey func(v cue.Value) (string, error)
Root cue.Value
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Obj cue.Value
Err errors.Error
}
A Context provides context for running a task.
func (*Context) Bytes ¶
func (*Context) Int64 ¶
func (*Context) Lookup ¶
func (*Context) String ¶
func (Context) TaskFunc ¶
NewTaskFunc creates a flow.TaskFunc that uses global settings from Context and a taskKey function to determine the kind of task to run.
type Runner ¶
type Runner interface {
// Runner runs given the current value and returns a new value which is to
// be unified with the original result.
Run(ctx *Context) (results interface{}, err error)
}
A Runner defines a command type.
type RunnerFunc ¶
A RunnerFunc creates a Runner.
func Lookup ¶
func Lookup(key string) RunnerFunc
Lookup returns the RunnerFunc for a key.
Source Files ¶
task.go
- Version
- v0.15.1 (latest)
- Published
- Nov 21, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 4 months ago –
Tools for package owners.