ast

package
v3.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 18 Imported by: 15 modules, 11 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 NamespaceSeparator = ":"

NamespaceSeparator contains the character that separates namespaces

Variables

View Source
var ErrIncludedTaskfilesCantHaveDotenvs = errors.New("task: Included Taskfiles can't have dotenv declarations. Please, move the dotenv declaration to the main Taskfile")

ErrIncludedTaskfilesCantHaveDotenvs is returned when a included Taskfile contains dotenvs

View Source
var V3 = semver.MustParse("3")

Functions

This section is empty.

Types

type Call

type Call struct {
	Task     string
	Vars     *Vars
	Silent   bool
	Indirect bool // True if the task was called by another task
}

Call is the parameters to a task call

type Cmd

type Cmd struct {
	Cmd         string
	Task        string
	For         *For
	Silent      bool
	Set         []string
	Shopt       []string
	Vars        *Vars
	IgnoreError bool
	Defer       bool
	Platforms   []*Platform
}

Cmd is a task command

func (*Cmd) DeepCopy

func (c *Cmd) DeepCopy() *Cmd

func (*Cmd) UnmarshalYAML

func (c *Cmd) UnmarshalYAML(node *yaml.Node) error

type Dep

type Dep struct {
	Task   string
	For    *For
	Vars   *Vars
	Silent bool
}

Dep is a task dependency

func (*Dep) DeepCopy

func (d *Dep) DeepCopy() *Dep

func (*Dep) UnmarshalYAML

func (d *Dep) UnmarshalYAML(node *yaml.Node) error

type ErrInvalidPlatform

type ErrInvalidPlatform struct {
	Platform string
}

func (*ErrInvalidPlatform) Error

func (err *ErrInvalidPlatform) Error() string

type For

type For struct {
	From   string
	List   []any
	Matrix omap.OrderedMap[string, []any]
	Var    string
	Split  string
	As     string
}

func (*For) DeepCopy

func (f *For) DeepCopy() *For

func (*For) UnmarshalYAML

func (f *For) UnmarshalYAML(node *yaml.Node) error

type Glob

type Glob struct {
	Glob   string
	Negate bool
}

func (*Glob) UnmarshalYAML

func (g *Glob) UnmarshalYAML(node *yaml.Node) error

type Include

type Include struct {
	Namespace      string
	Taskfile       string
	Dir            string
	Optional       bool
	Internal       bool
	Aliases        []string
	AdvancedImport bool
	Vars           *Vars
	Flatten        bool
}

Include represents information about included taskfiles

func (*Include) DeepCopy

func (include *Include) DeepCopy() *Include

DeepCopy creates a new instance of IncludedTaskfile and copies data by value from the source struct.

func (*Include) UnmarshalYAML

func (include *Include) UnmarshalYAML(node *yaml.Node) error

type Includes

type Includes struct {
	omap.OrderedMap[string, *Include]
}

Includes represents information about included tasksfiles

func (*Includes) Len

func (includes *Includes) Len() int

Len returns the length of the map

func (*Includes) Range

func (includes *Includes) Range(f func(k string, v *Include) error) error

Wrapper around OrderedMap.Set to ensure we don't get nil pointer errors

func (*Includes) UnmarshalYAML

func (includes *Includes) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Location

type Location struct {
	Line     int
	Column   int
	Taskfile string
}

func (*Location) DeepCopy

func (l *Location) DeepCopy() *Location

type MatchingTask added in v3.35.0

type MatchingTask struct {
	Task      *Task
	Wildcards []string
}

type Output

type Output struct {
	// Name of the Output.
	Name string `yaml:"-"`
	// Group specific style
	Group OutputGroup
}

Output of the Task output

func (*Output) IsSet

func (s *Output) IsSet() bool

IsSet returns true if and only if a custom output style is set.

func (*Output) UnmarshalYAML

func (s *Output) UnmarshalYAML(node *yaml.Node) error

type OutputGroup

type OutputGroup struct {
	Begin, End string
	ErrorOnly  bool `yaml:"error_only"`
}

OutputGroup is the style options specific to the Group style.

func (*OutputGroup) IsSet

func (g *OutputGroup) IsSet() bool

IsSet returns true if and only if a custom output style is set.

type Platform

type Platform struct {
	OS   string
	Arch string
}

Platform represents GOOS and GOARCH values

func (*Platform) DeepCopy

func (p *Platform) DeepCopy() *Platform

func (*Platform) UnmarshalYAML

func (p *Platform) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Precondition

type Precondition struct {
	Sh  string
	Msg string
}

Precondition represents a precondition necessary for a task to run

func (*Precondition) DeepCopy

func (p *Precondition) DeepCopy() *Precondition

func (*Precondition) UnmarshalYAML

func (p *Precondition) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Prompt added in v3.40.0

type Prompt []string

func (*Prompt) UnmarshalYAML added in v3.40.0

func (p *Prompt) UnmarshalYAML(node *yaml.Node) error

type Requires

type Requires struct {
	Vars []*VarsWithValidation
}

Requires represents a set of required variables necessary for a task to run

func (*Requires) DeepCopy

func (r *Requires) DeepCopy() *Requires

type Task

type Task struct {
	Task          string
	Cmds          []*Cmd
	Deps          []*Dep
	Label         string
	Desc          string
	Prompt        Prompt
	Summary       string
	Requires      *Requires
	Aliases       []string
	Sources       []*Glob
	Generates     []*Glob
	Status        []string
	Preconditions []*Precondition
	Dir           string
	Set           []string
	Shopt         []string
	Vars          *Vars
	Env           *Vars
	Dotenv        []string
	Silent        bool
	Interactive   bool
	Internal      bool
	Method        string
	Prefix        string
	IgnoreError   bool
	Run           string
	Platforms     []*Platform
	Watch         bool
	Location      *Location
	// Populated during merging
	Namespace            string
	IncludeVars          *Vars
	IncludedTaskfileVars *Vars
}

Task represents a task

func (*Task) DeepCopy

func (t *Task) DeepCopy() *Task

DeepCopy creates a new instance of Task and copies data by value from the source struct.

func (*Task) LocalName added in v3.38.0

func (t *Task) LocalName() string

func (*Task) Name

func (t *Task) Name() string

func (*Task) UnmarshalYAML

func (t *Task) UnmarshalYAML(node *yaml.Node) error

func (*Task) WildcardMatch added in v3.35.0

func (t *Task) WildcardMatch(name string) (bool, []string)

WildcardMatch will check if the given string matches the name of the Task and returns any wildcard values.

type Taskfile

type Taskfile struct {
	Location string
	Version  *semver.Version
	Output   Output
	Method   string
	Includes *Includes
	Set      []string
	Shopt    []string
	Vars     *Vars
	Env      *Vars
	Tasks    Tasks
	Silent   bool
	Dotenv   []string
	Run      string
	Interval time.Duration
}

Taskfile is the abstract syntax tree for a Taskfile

func (*Taskfile) Merge

func (t1 *Taskfile) Merge(t2 *Taskfile, include *Include) error

Merge merges the second Taskfile into the first

func (*Taskfile) UnmarshalYAML

func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error

type TaskfileGraph added in v3.37.0

type TaskfileGraph struct {
	sync.Mutex
	graph.Graph[string, *TaskfileVertex]
}

func NewTaskfileGraph added in v3.37.0

func NewTaskfileGraph() *TaskfileGraph

func (*TaskfileGraph) Merge added in v3.37.0

func (tfg *TaskfileGraph) Merge() (*Taskfile, error)

func (*TaskfileGraph) Visualize added in v3.37.0

func (tfg *TaskfileGraph) Visualize(filename string) error

type TaskfileVertex added in v3.37.0

type TaskfileVertex struct {
	URI      string
	Taskfile *Taskfile
}

A TaskfileVertex is a vertex on the Taskfile DAG.

type Tasks

type Tasks struct {
	omap.OrderedMap[string, *Task]
}

Tasks represents a group of tasks

func (*Tasks) FindMatchingTasks added in v3.35.0

func (t *Tasks) FindMatchingTasks(call *Call) []*MatchingTask

func (*Tasks) Merge

func (t1 *Tasks) Merge(t2 Tasks, include *Include, includedTaskfileVars *Vars) error

func (*Tasks) UnmarshalYAML

func (t *Tasks) UnmarshalYAML(node *yaml.Node) error

type Var

type Var struct {
	Value any
	Live  any
	Sh    *string
	Ref   string
	Dir   string
}

Var represents either a static or dynamic variable.

func (*Var) UnmarshalYAML

func (v *Var) UnmarshalYAML(node *yaml.Node) error

type Vars

type Vars struct {
	omap.OrderedMap[string, Var]
}

Vars is a string[string] variables map.

func (*Vars) DeepCopy

func (vs *Vars) DeepCopy() *Vars

DeepCopy creates a new instance of Vars and copies data by value from the source struct.

func (*Vars) Len

func (vs *Vars) Len() int

Wrapper around OrderedMap.Len to ensure we don't get nil pointer errors

func (*Vars) Merge

func (vs *Vars) Merge(other *Vars, include *Include)

Wrapper around OrderedMap.Merge to ensure we don't get nil pointer errors

func (*Vars) Range

func (vs *Vars) Range(f func(k string, v Var) error) error

Wrapper around OrderedMap.Set to ensure we don't get nil pointer errors

func (*Vars) ToCacheMap

func (vs *Vars) ToCacheMap() (m map[string]any)

ToCacheMap converts Vars to a map containing only the static variables

type VarsWithValidation added in v3.40.0

type VarsWithValidation struct {
	Name string
	Enum []string
}

func (*VarsWithValidation) DeepCopy added in v3.40.0

func (v *VarsWithValidation) DeepCopy() *VarsWithValidation

func (*VarsWithValidation) UnmarshalYAML added in v3.40.0

func (v *VarsWithValidation) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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