tasks

package
v0.0.0-...-c427923 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tasks contains the built-in tasks of Reginald the internal task-related utilities for running tasks and validating the task configs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate = errors.New("duplicate task")
)

Errors returned by the general taks functions.

Functions

func Configure

func Configure(
	ctx context.Context,
	cfg []taskcfg.Config,
	defaults taskcfg.Defaults,
	types TaskTypes,
) ([]taskcfg.Config, error)

Configure propagates the default values for task configs, assigns missing task IDs, and validates the task configs. The functions returns the new tasks configs and does not edit the slice in place.

func Run

func Run(ctx context.Context, cfg *config.Config, types TaskTypes) error

Run runs the tasks defined by cfg. The configuration does not guarantee the execution order, but Run resolves the defined dependencies and executes according to them.

Types

type Task

type Task struct {
	// Validate validates the given cfg for this task type.
	Validate func(ctx context.Context, t *Task, opts taskcfg.Options) error

	// Run runs the task.
	Run func(ctx context.Context, t *Task, dir fspath.Path, opts taskcfg.Options) error

	// Type is the name of the task type.
	Type string
}

A Task is a task within Reginald.

func NewLink() *Task

NewLink returns a new instance of the link task.

type TaskTypes

type TaskTypes map[string]*Task

TaskTypes is a map of the available task types by type.

func Tasks

func Tasks(ps []*plugins.Plugin) (TaskTypes, error)

Tasks returns the task instances that are available.

func (TaskTypes) LogValue

func (t TaskTypes) LogValue() slog.Value

LogValue implements slog.LogValuer for TaskTypes.

Jump to

Keyboard shortcuts

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