Documentation ¶
Overview ¶
Package file implements the core functionality to do with the spokfile.
Index ¶
Constants ¶
const NAME = "spokfile"
NAME is the canonical spok file name.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SpokFile ¶
type SpokFile struct { Vars map[string]string // Global variables in IDENT: value form (functions already evaluated) Tasks map[string]task.Task // Map of task name to the task itself Globs map[string][]string // Map of glob pattern to their concrete filepaths (avoids recalculating) Path string // The absolute path to the spokfile Dir string // The directory under which the spokfile sits // contains filtered or unexported fields }
SpokFile represents a concrete spokfile.
func New ¶
New converts a parsed spok AST into a concrete File object, root is the absolute path to the directory to use as root for glob expansion, typically the path to the directory the spokfile sits in.
func (*SpokFile) Env ¶
Env returns the spokfile Vars as a string slice of KEY=VALUE format so it may be passed to running task commands.
func (*SpokFile) HasTask ¶
HasTask returns whether or not the SpokFile has a task with the given name.
func (*SpokFile) Run ¶
func (s *SpokFile) Run(stream iostream.IOStream, runner shell.Runner, force bool, tasks ...string) (task.Results, error)
Run runs the specified tasks, it takes force which is a boolean flag set by the CLI which always reruns tasks and an io.Writer which is used only to echo the commands being run, the command's stdout and stderr is stored in the result.