Documentation
¶
Index ¶
- func Dotenv(vars *ast.Vars, tf *ast.Taskfile, dir string) (*ast.Vars, error)
- func Exists(path string) (string, error)
- func ExistsWalk(path string) (string, error)
- func RemoteExists(ctx context.Context, u *url.URL, timeout time.Duration) (*url.URL, error)
- type BaseNode
- type Cache
- type FileNode
- func (node *FileNode) FilenameAndLastDir() (string, string)
- func (node *FileNode) Location() string
- func (node *FileNode) Read(ctx context.Context) ([]byte, error)
- func (node *FileNode) Remote() bool
- func (node *FileNode) ResolveDir(dir string) (string, error)
- func (node *FileNode) ResolveEntrypoint(entrypoint string) (string, error)
- type GitNode
- func (node *GitNode) FilenameAndLastDir() (string, string)
- func (node *GitNode) Location() string
- func (node *GitNode) Read(_ 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)
- type HTTPNode
- func (node *HTTPNode) FilenameAndLastDir() (string, string)
- func (node *HTTPNode) Location() string
- func (node *HTTPNode) Read(ctx context.Context) ([]byte, error)
- func (node *HTTPNode) Remote() bool
- func (node *HTTPNode) ResolveDir(dir string) (string, error)
- func (node *HTTPNode) ResolveEntrypoint(entrypoint string) (string, error)
- type Node
- type NodeOption
- type Reader
- type ReaderDebugFunc
- type ReaderOption
- func WithDebugFunc(debugFunc ReaderDebugFunc) ReaderOption
- func WithDownload(download bool) ReaderOption
- func WithInsecure(insecure bool) ReaderOption
- func WithOffline(offline bool) ReaderOption
- func WithPromptFunc(promptFunc ReaderPromptFunc) ReaderOption
- func WithTempDir(tempDir string) ReaderOption
- func WithTimeout(timeout time.Duration) ReaderOption
- type ReaderPromptFunc
- type Snippet
- type SnippetOption
- type StdinNode
- func (node *StdinNode) FilenameAndLastDir() (string, string)
- func (node *StdinNode) Location() string
- func (node *StdinNode) Read(ctx context.Context) ([]byte, error)
- func (node *StdinNode) Remote() bool
- func (node *StdinNode) ResolveDir(dir string) (string, error)
- func (node *StdinNode) ResolveEntrypoint(entrypoint string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exists ¶ added in v3.34.0
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
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
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
type FileNode ¶ added in v3.34.0
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) FilenameAndLastDir ¶ added in v3.38.0
func (*FileNode) ResolveDir ¶ added in v3.36.0
type GitNode ¶ added in v3.40.0
An GitNode is a node that reads a Taskfile from a remote location via Git.
func NewGitNode ¶ added in v3.40.0
func (*GitNode) FilenameAndLastDir ¶ added in v3.40.0
func (*GitNode) ResolveDir ¶ added in v3.40.0
type HTTPNode ¶ added in v3.34.0
type HTTPNode struct {
*BaseNode
URL *url.URL // stores url pointing actual remote file. (e.g. with Taskfile.yml)
// 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) FilenameAndLastDir ¶ added in v3.38.0
func (*HTTPNode) ResolveDir ¶ added in v3.36.0
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)
}
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, opts ...ReaderOption, ) *Reader
NewReader constructs a new Taskfile Reader using the given Node and options.
type ReaderDebugFunc ¶ added in v3.42.0
type ReaderDebugFunc func(string)
ReaderDebugFunc is a function that is called when the reader wants to log debug messages
type ReaderOption ¶ added in v3.42.0
type ReaderOption func(*Reader)
ReaderOption is a function that configures a Reader.
func WithDebugFunc ¶ added in v3.42.0
func WithDebugFunc(debugFunc ReaderDebugFunc) ReaderOption
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) ReaderOption
WithDownload forces the reader to download a fresh copy of the taskfile from the remote source.
func WithInsecure ¶ added in v3.42.0
func WithInsecure(insecure bool) ReaderOption
WithInsecure enables insecure connections when reading remote taskfiles. By default, insecure connections are rejected.
func WithOffline ¶ added in v3.42.0
func WithOffline(offline bool) ReaderOption
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 WithPromptFunc ¶ added in v3.42.0
func WithPromptFunc(promptFunc ReaderPromptFunc) ReaderOption
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 the prompt was rejected. This can then be caught and used later when calling the Read method. By default, no prompt function is set and all prompts are automatically accepted.
func WithTempDir ¶ added in v3.42.0
func WithTempDir(tempDir string) ReaderOption
WithTempDir sets the temporary directory to be used by the reader. By default, the reader uses `os.TempDir()`.
func WithTimeout ¶ added in v3.42.0
func WithTimeout(timeout time.Duration) ReaderOption
WithTimeout sets the timeout for reading remote taskfiles. By default, the timeout is set to 10 seconds.
type ReaderPromptFunc ¶ added in v3.42.0
ReaderPromptFunc is a function that is called when the reader wants to prompt the user in some way
type Snippet ¶ added in v3.42.0
type Snippet struct {
// contains filtered or unexported fields
}
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.
type SnippetOption ¶ added in v3.42.0
type SnippetOption func(*Snippet)
func SnippetWithColumn ¶ added in v3.42.0
func SnippetWithColumn(column int) SnippetOption
func SnippetWithLine ¶ added in v3.42.0
func SnippetWithLine(line int) SnippetOption
func SnippetWithNoIndicators ¶ added in v3.42.0
func SnippetWithNoIndicators() SnippetOption
func SnippetWithPadding ¶ added in v3.42.0
func SnippetWithPadding(padding int) SnippetOption
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.