taskfile

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRitefiles = []string{
	"Ritefile",
	"Ritefile.yml",
	"ritefile.yml",
	"Ritefile.yaml",
	"ritefile.yaml",
	"Ritefile.dist.yml",
	"ritefile.dist.yml",
	"Ritefile.dist.yaml",
	"ritefile.dist.yaml",
}

DefaultRitefiles is the list of Ritefile file names supported by default.

Functions

func Dotenv

func Dotenv(vars *ast.Vars, tf *ast.Ritefile, dir string) (*ast.Vars, error)

func NewBaseNode

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

Types

type DebugFunc

type DebugFunc func(string)

DebugFunc is a function that can be called to log debug messages.

type FileNode

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

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

func NewFileNode

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

func (FileNode) Checksum

func (node FileNode) Checksum() string

func (FileNode) Dir

func (node FileNode) Dir() string

func (*FileNode) Location

func (node *FileNode) Location() string

func (FileNode) Parent

func (node FileNode) Parent() Node

func (*FileNode) Read

func (node *FileNode) Read() ([]byte, error)

func (*FileNode) ResolveDir

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

func (*FileNode) ResolveEntrypoint

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

func (FileNode) Verify

func (node FileNode) Verify(checksum string) bool

type Node

type Node interface {
	Read() ([]byte, error)
	Parent() Node
	Location() string
	Dir() string
	Checksum() string
	Verify(checksum string) bool
	ResolveEntrypoint(entrypoint string) (string, error)
	ResolveDir(dir string) (string, error)
}

func NewNode

func NewNode(
	entrypoint string,
	dir string,
	opts ...NodeOption,
) (Node, error)

func NewRootNode

func NewRootNode(
	entrypoint string,
	dir string,
	opts ...NodeOption,
) (Node, error)

type NodeOption

type NodeOption func(*baseNode)

func WithChecksum

func WithChecksum(checksum string) NodeOption

func WithParent

func WithParent(parent Node) NodeOption

type Reader

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

A Reader recursively reads Ritefiles from a given Node and builds a ast.RitefileGraph from them.

func NewReader

func NewReader(opts ...ReaderOption) *Reader

NewReader constructs a new Ritefile Reader using the given options.

func (*Reader) Options

func (r *Reader) Options(opts ...ReaderOption)

Options loops through the given ReaderOption functions and applies them to the Reader.

func (*Reader) Read

func (r *Reader) Read(ctx context.Context, node Node) (*ast.RitefileGraph, error)

Read will read the Ritefile defined by the given Node and recurse through any ast.Includes it finds, reading each included Ritefile and building an ast.RitefileGraph as it goes.

type ReaderOption

type ReaderOption interface {
	ApplyToReader(*Reader)
}

A ReaderOption is any type that can apply a configuration to a Reader.

func WithDebugFunc

func WithDebugFunc(debugFunc DebugFunc) ReaderOption

WithDebugFunc sets the debug function to be used by the Reader. If set, this function will be called with debug messages. By default, no debug function is set and the logs are not written.

type Snippet

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

A Snippet is a syntax highlighted snippet of a Ritefile with optional padding and a line and column indicator.

func NewSnippet

func NewSnippet(b []byte, opts ...SnippetOption) *Snippet

NewSnippet creates a new Snippet from a byte slice and a line and column number. The line and column numbers should be 1-indexed. For example, the first character in the file would be 1:1 (line 1, column 1). The padding determines the number of lines to include before and after the chosen line.

func (*Snippet) Options

func (s *Snippet) Options(opts ...SnippetOption)

Options loops through the given SnippetOption functions and applies them to the Snippet.

func (*Snippet) String

func (s *Snippet) String() string

type SnippetOption

type SnippetOption interface {
	ApplyToSnippet(*Snippet)
}

A SnippetOption is any type that can apply a configuration to a Snippet.

func WithColumn

func WithColumn(column int) SnippetOption

WithColumn specifies the column number that the Snippet should point to.

func WithLine

func WithLine(line int) SnippetOption

WithLine specifies the line number that the Snippet should center around and point to.

func WithNoIndicators

func WithNoIndicators() SnippetOption

WithNoIndicators specifies that the Snippet should not include line or column indicators.

func WithPadding

func WithPadding(padding int) SnippetOption

WithPadding specifies the number of lines to include before and after the selected line in the Snippet.

type StdinNode

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

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

func NewStdinNode

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

func (StdinNode) Checksum

func (node StdinNode) Checksum() string

func (StdinNode) Dir

func (node StdinNode) Dir() string

func (*StdinNode) Location

func (node *StdinNode) Location() string

func (StdinNode) Parent

func (node StdinNode) Parent() Node

func (*StdinNode) Read

func (node *StdinNode) Read() ([]byte, error)

func (*StdinNode) ResolveDir

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

func (*StdinNode) ResolveEntrypoint

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

func (StdinNode) Verify

func (node StdinNode) Verify(checksum string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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