taskfile

package
v3.40.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 31 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dotenv added in v3.34.0

func Dotenv(c *compiler.Compiler, tf *ast.Taskfile, dir string) (*ast.Vars, error)

func Exists added in v3.34.0

func Exists(l *logger.Logger, path string) (string, error)

Exists will check if a file at the given path Exists. If it does, it will return the path to it. If it does not, it will search for any files at the given path with any of the default Taskfile files names. If any of these match a file, the first matching path will be returned. If no files are found, an error will be returned.

func ExistsWalk added in v3.34.0

func ExistsWalk(l *logger.Logger, path string) (string, error)

ExistsWalk will check if a file at the given path exists by calling the exists function. If a file is not found, it will walk up the directory tree calling the exists function until it finds a file or reaches the root directory. On supported operating systems, it will also check if the user ID of the directory changes and abort if it does.

func RemoteExists added in v3.36.0

func RemoteExists(ctx context.Context, l *logger.Logger, u *url.URL, timeout time.Duration) (*url.URL, error)

RemoteExists will check if a file at the given URL Exists. If it does, it will return its URL. If it does not, it will search the search for any files at the given URL with any of the default Taskfile files names. If any of these match a file, the first matching path will be returned. If no files are found, an error will be returned.

Types

type BaseNode added in v3.34.0

type BaseNode struct {
	// contains filtered or unexported fields
}

BaseNode is a generic node that implements the Parent() methods of the NodeReader interface. It does not implement the Read() method and it designed to be embedded in other node types so that this boilerplate code does not need to be repeated.

func NewBaseNode added in v3.34.0

func NewBaseNode(dir string, opts ...NodeOption) *BaseNode

func (*BaseNode) Dir added in v3.36.0

func (node *BaseNode) Dir() string

func (*BaseNode) Parent added in v3.34.0

func (node *BaseNode) Parent() Node

type Cache added in v3.34.0

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache added in v3.34.0

func NewCache(dir string) (*Cache, error)

func (*Cache) Clear added in v3.38.0

func (c *Cache) Clear() error

type FileNode added in v3.34.0

type FileNode struct {
	*BaseNode
	Entrypoint string
}

A FileNode is a node that reads a taskfile from the local filesystem.

func NewFileNode added in v3.34.0

func NewFileNode(l *logger.Logger, entrypoint, dir string, opts ...NodeOption) (*FileNode, error)

func (*FileNode) FilenameAndLastDir added in v3.38.0

func (node *FileNode) FilenameAndLastDir() (string, string)

func (*FileNode) Location added in v3.34.0

func (node *FileNode) Location() string

func (*FileNode) Read added in v3.34.0

func (node *FileNode) Read(ctx context.Context) ([]byte, error)

func (*FileNode) Remote added in v3.34.0

func (node *FileNode) Remote() bool

func (*FileNode) ResolveDir added in v3.36.0

func (node *FileNode) ResolveDir(dir string) (string, error)

func (*FileNode) ResolveEntrypoint added in v3.36.0

func (node *FileNode) ResolveEntrypoint(entrypoint string) (string, error)

type GitNode added in v3.40.0

type GitNode struct {
	*BaseNode
	URL *url.URL
	// contains filtered or unexported fields
}

An GitNode is a node that reads a Taskfile from a remote location via Git.

func NewGitNode added in v3.40.0

func NewGitNode(
	entrypoint string,
	dir string,
	insecure bool,
	opts ...NodeOption,
) (*GitNode, error)

func (*GitNode) FilenameAndLastDir added in v3.40.0

func (node *GitNode) FilenameAndLastDir() (string, string)

func (*GitNode) Location added in v3.40.0

func (node *GitNode) Location() string

func (*GitNode) Read added in v3.40.0

func (node *GitNode) Read(_ context.Context) ([]byte, error)

func (*GitNode) Remote added in v3.40.0

func (node *GitNode) Remote() bool

func (*GitNode) ResolveDir added in v3.40.0

func (node *GitNode) ResolveDir(dir string) (string, error)

func (*GitNode) ResolveEntrypoint added in v3.40.0

func (node *GitNode) ResolveEntrypoint(entrypoint string) (string, error)

type HTTPNode added in v3.34.0

type HTTPNode struct {
	*BaseNode
	URL *url.URL
	// contains filtered or unexported fields
}

An HTTPNode is a node that reads a Taskfile from a remote location via HTTP.

func NewHTTPNode added in v3.34.0

func NewHTTPNode(
	l *logger.Logger,
	entrypoint string,
	dir string,
	insecure bool,
	timeout time.Duration,
	opts ...NodeOption,
) (*HTTPNode, error)

func (*HTTPNode) FilenameAndLastDir added in v3.38.0

func (node *HTTPNode) FilenameAndLastDir() (string, string)

func (*HTTPNode) Location added in v3.34.0

func (node *HTTPNode) Location() string

func (*HTTPNode) Read added in v3.34.0

func (node *HTTPNode) Read(ctx context.Context) ([]byte, error)

func (*HTTPNode) Remote added in v3.34.0

func (node *HTTPNode) Remote() bool

func (*HTTPNode) ResolveDir added in v3.36.0

func (node *HTTPNode) ResolveDir(dir string) (string, error)

func (*HTTPNode) ResolveEntrypoint added in v3.36.0

func (node *HTTPNode) ResolveEntrypoint(entrypoint string) (string, error)

type Node added in v3.34.0

type Node interface {
	Read(ctx context.Context) ([]byte, error)
	Parent() Node
	Location() string
	Dir() string
	Remote() bool
	ResolveEntrypoint(entrypoint string) (string, error)
	ResolveDir(dir string) (string, error)
	FilenameAndLastDir() (string, string)
}

func NewNode added in v3.34.0

func NewNode(
	l *logger.Logger,
	entrypoint string,
	dir string,
	insecure bool,
	timeout time.Duration,
	opts ...NodeOption,
) (Node, error)

func NewRootNode added in v3.35.0

func NewRootNode(
	l *logger.Logger,
	entrypoint string,
	dir string,
	insecure bool,
	timeout time.Duration,
) (Node, error)

type NodeOption added in v3.34.0

type NodeOption func(*BaseNode)

func WithParent added in v3.34.0

func WithParent(parent Node) NodeOption

type Reader added in v3.37.0

type Reader struct {
	// contains filtered or unexported fields
}

A Reader will recursively read Taskfiles from a given source using a directed acyclic graph (DAG).

func NewReader added in v3.37.0

func NewReader(
	node Node,
	insecure bool,
	download bool,
	offline bool,
	timeout time.Duration,
	tempDir string,
	logger *logger.Logger,
) *Reader

func (*Reader) Read added in v3.37.0

func (r *Reader) Read() (*ast.TaskfileGraph, error)

type StdinNode added in v3.35.0

type StdinNode struct {
	*BaseNode
}

A StdinNode is a node that reads a taskfile from the standard input stream.

func NewStdinNode added in v3.35.0

func NewStdinNode(dir string) (*StdinNode, error)

func (*StdinNode) FilenameAndLastDir added in v3.38.0

func (node *StdinNode) FilenameAndLastDir() (string, string)

func (*StdinNode) Location added in v3.35.0

func (node *StdinNode) Location() string

func (*StdinNode) Read added in v3.35.0

func (node *StdinNode) Read(ctx context.Context) ([]byte, error)

func (*StdinNode) Remote added in v3.35.0

func (node *StdinNode) Remote() bool

func (*StdinNode) ResolveDir added in v3.36.0

func (node *StdinNode) ResolveDir(dir string) (string, error)

func (*StdinNode) ResolveEntrypoint added in v3.36.0

func (node *StdinNode) ResolveEntrypoint(entrypoint string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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