Documentation
¶
Index ¶
- Variables
- func CleanGitCache() error
- func Dotenv(vars *ast.Vars, tf *ast.Taskfile, dir string) (*ast.Vars, error)
- func IsRemoteEntrypoint(entrypoint string) bool
- func NewBaseNode(dir string, opts ...NodeOption) *baseNode
- func RemoteExists(ctx context.Context, u url.URL, client *http.Client) (*url.URL, error)
- func WithCACert(caCert string) *caCertOption
- func WithCacheExpiryDuration(duration time.Duration) *cacheExpiryDurationOption
- func WithCert(cert string) *certOption
- func WithCertKey(certKey string) *certKeyOption
- func WithChecksum(checksum string) *checksumOption
- func WithColumn(column int) *columnOption
- func WithDebugFunc(debugFunc DebugFunc) *debugFuncOption
- func WithDownload(download bool) *downloadOption
- func WithHeaders(headersByHost HeadersByHost) *headersOption
- func WithInsecure(insecure bool) *insecureOption
- func WithLine(line int) *lineOption
- func WithNoIndicators() *noIndicatorsOption
- func WithOffline(offline bool) *offlineOption
- func WithPadding(padding int) *paddingOption
- func WithParent(parent Node) *parentOption
- func WithPromptFunc(promptFunc PromptFunc) *promptFuncOption
- func WithReaderHeaders(headersByHost HeadersByHost) *readerHeadersOption
- func WithTempDir(tempDir string) *tempDirOption
- func WithTrustedHosts(trustedHosts []string) *trustedHostsOption
- type CacheNode
- func (node CacheNode) Checksum() string
- func (node *CacheNode) ChecksumPrompt(checksum string) string
- func (node *CacheNode) CreateCacheDir() error
- func (node CacheNode) Dir() string
- func (node *CacheNode) Location() string
- func (node CacheNode) Parent() Node
- func (node *CacheNode) Read() ([]byte, error)
- func (node *CacheNode) ReadChecksum() string
- func (node *CacheNode) ReadTimestamp() time.Time
- func (node CacheNode) Verify(checksum string) bool
- func (node *CacheNode) Write(data []byte) error
- func (node *CacheNode) WriteChecksum(checksum string) error
- func (node *CacheNode) WriteTimestamp(t time.Time) error
- 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 GitNode
- func (node *GitNode) CacheKey() string
- func (node GitNode) Checksum() string
- func (node GitNode) Dir() string
- func (node *GitNode) Location() string
- func (node GitNode) Parent() Node
- func (node *GitNode) Read() ([]byte, error)
- func (node *GitNode) ReadContext(ctx context.Context) ([]byte, error)
- func (node *GitNode) Remote() bool
- func (node *GitNode) ResolveDir(dir string) (string, error)
- func (node *GitNode) ResolveEntrypoint(entrypoint string) (string, error)
- func (node GitNode) Verify(checksum string) bool
- type HTTPNode
- func (node *HTTPNode) CacheKey() string
- func (node HTTPNode) Checksum() string
- func (node HTTPNode) Dir() string
- func (node *HTTPNode) Location() string
- func (node HTTPNode) Parent() Node
- func (node *HTTPNode) Read() ([]byte, error)
- func (node *HTTPNode) ReadContext(ctx context.Context) ([]byte, error)
- func (node *HTTPNode) ResolveDir(dir string) (string, error)
- func (node *HTTPNode) ResolveEntrypoint(entrypoint string) (string, error)
- func (node HTTPNode) Verify(checksum string) bool
- type HeadersByHost
- type Node
- type NodeOption
- type PromptFunc
- type Reader
- type ReaderOption
- type RemoteNode
- 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) Remote() bool
- 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 ( // DefaultTaskfiles is the list of Taskfile file names supported by default. DefaultTaskfiles = []string{ "Taskfile.yml", "taskfile.yml", "Taskfile.yaml", "taskfile.yaml", "Taskfile.dist.yml", "taskfile.dist.yml", "Taskfile.dist.yaml", "taskfile.dist.yaml", } )
Functions ¶
func CleanGitCache ¶ added in v3.46.0
func CleanGitCache() error
func IsRemoteEntrypoint ¶ added in v3.52.0
func NewBaseNode ¶ added in v3.34.0
func NewBaseNode(dir string, opts ...NodeOption) *baseNode
func RemoteExists ¶ added in v3.36.0
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.
func WithCACert ¶ added in v3.48.0
func WithCACert(caCert string) *caCertOption
WithCACert sets the path to a custom CA certificate for TLS connections.
func WithCacheExpiryDuration ¶ added in v3.43.0
WithCacheExpiryDuration sets the duration after which the cache is considered expired. By default, the cache is considered expired after 24 hours.
func WithCert ¶ added in v3.48.0
func WithCert(cert string) *certOption
WithCert sets the path to a client certificate for TLS connections.
func WithCertKey ¶ added in v3.48.0
func WithCertKey(certKey string) *certKeyOption
WithCertKey sets the path to a client certificate key for TLS connections.
func WithChecksum ¶ added in v3.44.0
func WithChecksum(checksum string) *checksumOption
WithChecksum sets the checksum for the node base.
func WithColumn ¶ added in v3.43.0
func WithColumn(column int) *columnOption
WithColumn specifies the column number that the Snippet should point to.
func WithDebugFunc ¶ added in v3.42.0
func WithDebugFunc(debugFunc DebugFunc) *debugFuncOption
WithDebugFunc sets the debug function to be used by the Reader. If set, this function will be called with debug messages. This can be useful if the caller wants to log debug messages from the Reader. By default, no debug function is set and the logs are not written.
func WithDownload ¶ added in v3.42.0
func WithDownload(download bool) *downloadOption
WithDownload forces the Reader to download a fresh copy of the taskfile from the remote source.
func WithHeaders ¶ added in v3.54.0
func WithHeaders(headersByHost HeadersByHost) *headersOption
WithHeaders sets the HTTP headers to send, keyed by host.
func WithInsecure ¶ added in v3.42.0
func WithInsecure(insecure bool) *insecureOption
WithInsecure allows the Reader to make insecure connections when reading remote taskfiles. By default, insecure connections are rejected.
func WithLine ¶ added in v3.43.0
func WithLine(line int) *lineOption
WithLine specifies the line number that the Snippet should center around and point to.
func WithNoIndicators ¶ added in v3.43.0
func WithNoIndicators() *noIndicatorsOption
WithNoIndicators specifies that the Snippet should not include line or column indicators.
func WithOffline ¶ added in v3.42.0
func WithOffline(offline bool) *offlineOption
WithOffline stops the Reader from being able to make network connections. It will still be able to read local files and cached copies of remote files.
func WithPadding ¶ added in v3.43.0
func WithPadding(padding int) *paddingOption
WithPadding specifies the number of lines to include before and after the selected line in the Snippet.
func WithParent ¶ added in v3.34.0
func WithParent(parent Node) *parentOption
WithParent sets the parent node for the node base.
func WithPromptFunc ¶ added in v3.42.0
func WithPromptFunc(promptFunc PromptFunc) *promptFuncOption
WithPromptFunc sets the prompt function to be used by the Reader. If set, this function will be called with prompt messages. The function should optionally log the message to the user and return nil if the prompt is accepted and the execution should continue. Otherwise, it should return an error which describes why the prompt was rejected. This can then be caught and used later when calling the Reader.Read method. By default, no prompt function is set and all prompts are automatically accepted.
func WithReaderHeaders ¶ added in v3.54.0
func WithReaderHeaders(headersByHost HeadersByHost) *readerHeadersOption
WithReaderHeaders sets the HTTP headers to send to each configured host.
func WithTempDir ¶ added in v3.42.0
func WithTempDir(tempDir string) *tempDirOption
WithTempDir sets the temporary directory that will be used by the Reader. By default, the reader uses os.TempDir.
func WithTrustedHosts ¶ added in v3.46.0
func WithTrustedHosts(trustedHosts []string) *trustedHostsOption
WithTrustedHosts configures the Reader with a list of trusted hosts for remote Taskfiles. Hosts in this list will not prompt for user confirmation.
Types ¶
type CacheNode ¶ added in v3.43.0
type CacheNode struct {
// contains filtered or unexported fields
}
func NewCacheNode ¶ added in v3.43.0
func NewCacheNode(source RemoteNode, dir string) *CacheNode
func (*CacheNode) ChecksumPrompt ¶ added in v3.43.0
func (*CacheNode) CreateCacheDir ¶ added in v3.43.0
func (*CacheNode) ReadChecksum ¶ added in v3.43.0
func (*CacheNode) ReadTimestamp ¶ added in v3.43.0
func (*CacheNode) WriteChecksum ¶ added in v3.43.0
type DebugFunc ¶ added in v3.43.0
type DebugFunc func(string)
DebugFunc is a function that can be called to log debug messages.
type FileNode ¶ added in v3.34.0
type FileNode struct {
// contains filtered or unexported fields
}
A FileNode is a node that reads a taskfile from the local filesystem.
func NewFileNode ¶ added in v3.34.0
func NewFileNode(entrypoint, dir string, opts ...NodeOption) (*FileNode, error)
func (*FileNode) ResolveDir ¶ added in v3.36.0
func (*FileNode) ResolveEntrypoint ¶ added in v3.36.0
type GitNode ¶ added in v3.40.0
type GitNode struct {
// 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 (*GitNode) ReadContext ¶ added in v3.43.0
func (*GitNode) ResolveDir ¶ added in v3.40.0
func (*GitNode) ResolveEntrypoint ¶ added in v3.40.0
type HTTPNode ¶ added in v3.34.0
type HTTPNode struct {
// 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 (*HTTPNode) ReadContext ¶ added in v3.43.0
func (*HTTPNode) ResolveDir ¶ added in v3.36.0
func (*HTTPNode) ResolveEntrypoint ¶ added in v3.36.0
type HeadersByHost ¶ added in v3.54.0
HeadersByHost configures HTTP headers per host for remote Taskfiles. Values support template functions, but not Taskfile variables.
type Node ¶ added in v3.34.0
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 ¶ added in v3.35.0
type NodeOption ¶ added in v3.34.0
type NodeOption interface {
ApplyToBaseNode(n *baseNode)
}
type PromptFunc ¶ added in v3.43.0
PromptFunc is a function that can be called to prompt the user for input.
type Reader ¶ added in v3.37.0
type Reader struct {
// contains filtered or unexported fields
}
A Reader will recursively read Taskfiles from a given Node and build a ast.TaskfileGraph from them.
func NewReader ¶ added in v3.37.0
func NewReader(opts ...ReaderOption) *Reader
NewReader constructs a new Taskfile Reader using the given Node and options.
func (*Reader) Options ¶ added in v3.43.0
func (r *Reader) Options(opts ...ReaderOption)
Options loops through the given ReaderOption functions and applies them to the Reader.
func (*Reader) Read ¶ added in v3.37.0
Read will read the Taskfile defined by the Reader's Node and recurse through any ast.Includes it finds, reading each included Taskfile and building an ast.TaskfileGraph as it goes. If any errors occur, they will be returned immediately.
type ReaderOption ¶ added in v3.42.0
type ReaderOption interface {
ApplyToReader(*Reader)
}
A ReaderOption is any type that can apply a configuration to a Reader.
type RemoteNode ¶ added in v3.43.0
type Snippet ¶ added in v3.42.0
type Snippet struct {
// contains filtered or unexported fields
}
A Snippet is a syntax highlighted snippet of a Taskfile with optional padding and a line and column indicator.
func NewSnippet ¶ added in v3.42.0
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 ¶ added in v3.43.0
func (s *Snippet) Options(opts ...SnippetOption)
Options loops through the given SnippetOption functions and applies them to the Snippet.
type SnippetOption ¶ added in v3.42.0
type SnippetOption interface {
ApplyToSnippet(*Snippet)
}
A SnippetOption is any type that can apply a configuration to a Snippet.
type StdinNode ¶ added in v3.35.0
type StdinNode struct {
// contains filtered or unexported fields
}
A StdinNode is a node that reads a taskfile from the standard input stream.