Documentation
¶
Overview ¶
Package task handles core spok functionality related to the processing of declared tasks e.g. expanding glob patterns, parsing from an ast node etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Task string `json:"task"` // The name of the task
CommandResults shell.Results `json:"results"` // The results of running the tasks commands
Skipped bool `json:"skipped"` // Whether the task was skipped or run
}
Result encodes the overall result of running a task which may involve any number of shell commands.
type Task ¶
type Task struct {
Doc string // The task docstring
Name string // Task name
TaskDependencies []string // Other tasks or idents this task depends on (by name)
FileDependencies []string // Filepaths this task depends on
GlobDependencies []string // Filepath dependencies that are specified as glob patterns
Commands []string // Shell commands to run
NamedOutputs []string // Other outputs by ident
FileOutputs []string // Filepaths this task outputs
GlobOutputs []string // Filepaths this task outputs that are specified as glob patterns
}
Task represents a spok Task.
func New ¶
New parses a task AST node into a concrete task, root is the absolute path of the directory to use as the root for glob expansion, typically the path to the spokfile.
func (*Task) Run ¶
func (t *Task) Run(runner shell.Runner, stream iostream.IOStream, env []string) (shell.Results, error)
Run runs a task commands in order, echoing each one to out and returning the list of results containing the exit status, stdout and stderr of each command.
If the task has no commands, this becomes a no-op.