Go API Documentation

github.com/go-task/task/v3/taskfile/ast

No package summary is available.

Package

Files: 18. Third party imports: 6. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Constants

Vars

ErrIncludedTaskfilesCantHaveDotenvs is returned when a included Taskfile contains dotenvs

Types

Cmd

Cmd is a task command

Field name Field type Comment
Cmd

string

No comment on field.
Task

string

No comment on field.
For

*For

No comment on field.
Silent

bool

No comment on field.
Set

[]string

No comment on field.
Shopt

[]string

No comment on field.
Vars

*Vars

No comment on field.
IgnoreError

bool

No comment on field.
Defer

bool

No comment on field.
Platforms

[]*Platform

No comment on field.

Defer

This type doesn't have documentation.

Field name Field type Comment
Cmd

string

No comment on field.
Task

string

No comment on field.
Vars

*Vars

No comment on field.
Silent

bool

No comment on field.

Dep

Dep is a task dependency

Field name Field type Comment
Task

string

No comment on field.
For

*For

No comment on field.
Vars

*Vars

No comment on field.
Silent

bool

No comment on field.

ErrInvalidPlatform

This type doesn't have documentation.

Field name Field type Comment
Platform

string

No comment on field.

For

This type doesn't have documentation.

Field name Field type Comment
From

string

No comment on field.
List

[]any

No comment on field.
Matrix

*Matrix

No comment on field.
Var

string

No comment on field.
Split

string

No comment on field.
As

string

No comment on field.

Glob

This type doesn't have documentation.

Field name Field type Comment
Glob

string

No comment on field.
Negate

bool

No comment on field.

Location

This type doesn't have documentation.

Field name Field type Comment
Line

int

No comment on field.
Column

int

No comment on field.
Taskfile

string

No comment on field.

Output

Output of the Task output

Field name Field type Comment
Name

string

Name of the Output.

Group

OutputGroup

Group specific style

OutputGroup

OutputGroup is the style options specific to the Group style.

Field name Field type Comment
Begin

string

No comment on field.
ErrorOnly

bool

No comment on field.

Platform

Platform represents GOOS and GOARCH values

Field name Field type Comment
OS

string

No comment on field.
Arch

string

No comment on field.

Precondition

Precondition represents a precondition necessary for a task to run

Field name Field type Comment
Sh

string

No comment on field.
Msg

string

No comment on field.

Prompt

This type doesn't have documentation.

Field name Field type Comment
type

[]string

No comment on field.

Requires

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

Field name Field type Comment
Vars

[]*VarsWithValidation

No comment on field.

Task

Task represents a task

Field name Field type Comment
Task

string

No comment on field.
Cmds

[]*Cmd

No comment on field.
Deps

[]*Dep

No comment on field.
Label

string

No comment on field.
Desc

string

No comment on field.
Prompt

Prompt

No comment on field.
Summary

string

No comment on field.
Requires

*Requires

No comment on field.
Aliases

[]string

No comment on field.
Sources

[]*Glob

No comment on field.
Generates

[]*Glob

No comment on field.
Status

[]string

No comment on field.
Preconditions

[]*Precondition

No comment on field.
Dir

string

No comment on field.
Set

[]string

No comment on field.
Shopt

[]string

No comment on field.
Vars

*Vars

No comment on field.
Env

*Vars

No comment on field.
Dotenv

[]string

No comment on field.
Silent

bool

No comment on field.
Interactive

bool

No comment on field.
Internal

bool

No comment on field.
Method

string

No comment on field.
Prefix

string

No comment on field.
IgnoreError

bool

No comment on field.
Run

string

No comment on field.
Platforms

[]*Platform

No comment on field.
Watch

bool

No comment on field.
Location

*Location

No comment on field.
Namespace

string

Populated during merging

IncludeVars

*Vars

No comment on field.
IncludedTaskfileVars

*Vars

No comment on field.

Taskfile

Taskfile is the abstract syntax tree for a Taskfile

Field name Field type Comment
Location

string

No comment on field.
Version

*semver.Version

No comment on field.
Output

Output

No comment on field.
Method

string

No comment on field.
Includes

*Includes

No comment on field.
Set

[]string

No comment on field.
Shopt

[]string

No comment on field.
Vars

*Vars

No comment on field.
Env

*Vars

No comment on field.
Tasks

*Tasks

No comment on field.
Silent

bool

No comment on field.
Dotenv

[]string

No comment on field.
Run

string

No comment on field.
Interval

time.Duration

No comment on field.

TaskfileGraph

This type doesn't have documentation.

Field name Field type Comment

sync.Mutex

No comment on field.

graph.Graph[string, *TaskfileVertex]

No comment on field.

TaskfileVertex

A TaskfileVertex is a vertex on the Taskfile DAG.

Field name Field type Comment
URI

string

No comment on field.
Taskfile

*Taskfile

No comment on field.

Var

Var represents either a static or dynamic variable.

Field name Field type Comment
Value

any

No comment on field.
Live

any

No comment on field.
Sh

*string

No comment on field.
Ref

string

No comment on field.
Dir

string

No comment on field.

VarsWithValidation

This type doesn't have documentation.

Field name Field type Comment
Name

string

No comment on field.
Enum

[]string

No comment on field.

Matrix, MatrixElement, MatrixRow

This type doesn't have documentation.

Field name Field type Comment
om

*orderedmap.OrderedMap[string, *MatrixRow]

No comment on field.
type

orderedmap.Element[string, *MatrixRow]

No comment on field.
Ref

string

No comment on field.
Value

[]any

No comment on field.

Include, Includes, IncludeElement

This type doesn't have documentation.

Field name Field type Comment
Namespace

string

No comment on field.
Taskfile

string

No comment on field.
Dir

string

No comment on field.
Optional

bool

No comment on field.
Internal

bool

No comment on field.
Aliases

[]string

No comment on field.
Excludes

[]string

No comment on field.
AdvancedImport

bool

No comment on field.
Vars

*Vars

No comment on field.
Flatten

bool

No comment on field.
Checksum

string

No comment on field.
om

*orderedmap.OrderedMap[string, *Include]

No comment on field.
mutex

sync.RWMutex

No comment on field.
type

orderedmap.Element[string, *Include]

No comment on field.

Tasks, TaskElement

This type doesn't have documentation.

Field name Field type Comment
om

*orderedmap.OrderedMap[string, *Task]

No comment on field.
mutex

sync.RWMutex

No comment on field.
type

orderedmap.Element[string, *Task]

No comment on field.

Vars, VarElement

This type doesn't have documentation.

Field name Field type Comment
om

*orderedmap.OrderedMap[string, Var]

No comment on field.
mutex

sync.RWMutex

No comment on field.
type

orderedmap.Element[string, Var]

No comment on field.

Functions

func NewIncludes

NewIncludes creates a new instance of Includes and initializes it with the provided set of elements, if any. The elements are added in the order they are passed.

func NewMatrix

func NewTaskfileGraph

Uses: graph.Directed, graph.New, graph.PreventCycles, graph.Rooted, sync.Mutex.

func NewTasks

NewTasks creates a new instance of Tasks and initializes it with the provided set of elements, if any. The elements are added in the order they are passed.

func NewVars

NewVars creates a new instance of Vars and initializes it with the provided set of elements, if any. The elements are added in the order they are passed.

func (*Cmd) DeepCopy

Uses: deepcopy.Slice.

func (*Cmd) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Defer) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Dep) DeepCopy

func (*Dep) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*ErrInvalidPlatform) Error

Uses: fmt.Sprintf.

func (*For) DeepCopy

Uses: deepcopy.Slice.

func (*For) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Glob) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Include) DeepCopy

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

Uses: deepcopy.Slice.

func (*Include) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Includes) All

All returns an iterator that loops over all task key-value pairs. Range calls the provided function for each include in the map. The function receives the include's key and value as arguments. If the function returns an error, the iteration stops and the error is returned.

func (*Includes) Get

Get returns the value the the include with the provided key and a boolean that indicates if the value was found or not. If the value is not found, the returned include is a zero value and the bool is false.

func (*Includes) Keys

Keys returns an iterator that loops over all task keys.

func (*Includes) Len

Len returns the number of includes in the Includes map.

func (*Includes) Set

Set sets the value of the include with the provided key to the provided value. If the include already exists, its value is updated. If the include does not exist, it is created.

func (*Includes) UnmarshalYAML

UnmarshalYAML implements the yaml.Unmarshaler interface.

Uses: errors.NewTaskfileDecodeError.

func (*Includes) Values

Values returns an iterator that loops over all task values.

func (*Location) DeepCopy

func (*Matrix) All

All returns an iterator that loops over all task key-value pairs.

func (*Matrix) DeepCopy

Uses: deepcopy.OrderedMap.

func (*Matrix) Get

func (*Matrix) Keys

Keys returns an iterator that loops over all task keys.

func (*Matrix) Len

func (*Matrix) Set

func (*Matrix) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Matrix) Values

Values returns an iterator that loops over all task values.

func (*Output) IsSet

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

func (*Output) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*OutputGroup) IsSet

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

func (*Platform) DeepCopy

func (*Platform) UnmarshalYAML

UnmarshalYAML implements yaml.Unmarshaler interface.

Uses: errors.NewTaskfileDecodeError.

func (*Precondition) DeepCopy

func (*Precondition) UnmarshalYAML

UnmarshalYAML implements yaml.Unmarshaler interface.

Uses: errors.NewTaskfileDecodeError, fmt.Sprintf.

func (*Prompt) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Requires) DeepCopy

Uses: deepcopy.Slice.

func (*Task) DeepCopy

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

Uses: deepcopy.Slice.

func (*Task) LocalName

Uses: strings.TrimPrefix.

func (*Task) Name

func (*Task) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Task) WildcardMatch

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

Uses: fmt.Sprintf, regexp.MustCompile, strings.Count, strings.ReplaceAll.

func (*Taskfile) Merge

Merge merges the second Taskfile into the first

Uses: fmt.Errorf.

func (*Taskfile) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError, time.Duration.

func (*TaskfileGraph) Merge

Uses: errgroup.Group, fmt.Errorf, graph.TopologicalSort.

func (*TaskfileGraph) Visualize

Uses: draw.DOT, os.Create.

func (*Tasks) All

All returns an iterator that loops over all task key-value pairs in the order specified by the sorter.

Uses: slices.Collect.

func (*Tasks) Get

Get returns the value the the task with the provided key and a boolean that indicates if the value was found or not. If the value is not found, the returned task is a zero value and the bool is false.

func (*Tasks) Keys

Keys returns an iterator that loops over all task keys in the order specified by the sorter.

func (*Tasks) Len

Len returns the number of variables in the Tasks map.

func (*Tasks) Merge

Uses: errors.TaskNameFlattenConflictError, filepathext.SmartJoin, fmt.Sprintf, slices.Concat, slices.Contains.

func (*Tasks) Set

Set sets the value of the task with the provided key to the provided value. If the task already exists, its value is updated. If the task does not exist, it is created.

func (*Tasks) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Tasks) Values

Values returns an iterator that loops over all task values in the order specified by the sorter.

func (*Var) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Vars) All

All returns an iterator that loops over all task key-value pairs.

func (*Vars) DeepCopy

Uses: deepcopy.OrderedMap.

func (*Vars) Get

Get returns the value the the variable with the provided key and a boolean that indicates if the value was found or not. If the value is not found, the returned variable is a zero value and the bool is false.

func (*Vars) Keys

Keys returns an iterator that loops over all task keys.

func (*Vars) Len

Len returns the number of variables in the Vars map.

func (*Vars) Merge

Merge loops over other and merges it values with the variables in vars. If the include parameter is not nil and its it is an advanced import, the directory is set set to the value of the include parameter.

func (*Vars) Set

Set sets the value of the variable with the provided key to the provided value. If the variable already exists, its value is updated. If the variable does not exist, it is created.

func (*Vars) ToCacheMap

ToCacheMap converts Vars to an unordered map containing only the static variables

func (*Vars) UnmarshalYAML

Uses: errors.NewTaskfileDecodeError.

func (*Vars) Values

Values returns an iterator that loops over all task values.

func (*VarsWithValidation) DeepCopy

func (*VarsWithValidation) UnmarshalYAML

UnmarshalYAML implements yaml.Unmarshaler interface.

Uses: errors.NewTaskfileDecodeError.

Private functions

func taskNameWithNamespace

References: fmt.Sprintf, strings.HasPrefix, strings.TrimPrefix.

func taskfileHash

func parseArch

References: fmt.Errorf, goext.IsKnownArch.

func parseOsOrArch

parseOsOrArch will check if the given input is a valid OS or Arch value. If so, it will store it. If not, an error is returned

References: fmt.Errorf, goext.IsKnownArch, goext.IsKnownOS.

func parsePlatform

parsePlatform takes a string representing an OS/Arch combination (or either on their own) and parses it into the Platform struct. It returns an error if the input string is invalid. Valid combinations for input: OS, Arch, OS/Arch

References: strings.Split.


Tests

Files: 1. Third party imports: 2. Imports from organisation: 0. Tests: 1. Benchmarks: 0.

Test functions

TestPlatformParsing

References: assert.Equal, require.Error, require.NoError, testing.T.