Documentation
¶
Index ¶
- Variables
- func Dotenv(vars *ast.Vars, tf *ast.Ritefile, dir string) (*ast.Vars, error)
- func NewBaseNode(dir string, opts ...NodeOption) *baseNode
- type DebugFunc
- type FileNode
- func (node FileNode) Checksum() string
- func (node FileNode) Dir() string
- func (node *FileNode) Location() string
- func (node FileNode) Parent() Node
- func (node *FileNode) Read() ([]byte, error)
- func (node *FileNode) ResolveDir(dir string) (string, error)
- func (node *FileNode) ResolveEntrypoint(entrypoint string) (string, error)
- func (node FileNode) Verify(checksum string) bool
- type Node
- type NodeOption
- type Reader
- type ReaderOption
- type Snippet
- type SnippetOption
- type StdinNode
- func (node StdinNode) Checksum() string
- func (node StdinNode) Dir() string
- func (node *StdinNode) Location() string
- func (node StdinNode) Parent() Node
- func (node *StdinNode) Read() ([]byte, error)
- func (node *StdinNode) ResolveDir(dir string) (string, error)
- func (node *StdinNode) ResolveEntrypoint(entrypoint string) (string, error)
- func (node StdinNode) Verify(checksum string) bool
Constants ¶
This section is empty.
Variables ¶
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 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) ResolveEntrypoint ¶
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 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 ¶
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.
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.