{"modulePath":"github.com/Ensono/taskctl","version":"v1.7.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package task\n\n## Types\n\n```go\ntype Artifact struct {\n\t// Name is the key under which the artifacts will be stored\n\t//\n\t// Currently this is unused\n\tName string `mapstructure:\"name\" yaml:\"name,omitempty\" json:\"name,omitempty\"`\n\t// Path is the glob like pattern to the\n\t// source of the file(s) to store as an output\n\tPath string `mapstructure:\"path\" yaml:\"path\" json:\"path\"`\n\t// Type is the artifact type\n\t// valid values are `file`|`dotenv`\n\tType ArtifactType `mapstructure:\"type\" yaml:\"type\" json:\"type\" jsonschema:\"enum=dotenv,enum=file,default=file\"`\n}\n```\nArtifact holds the information about the artifact to produce for the specific task.\n\nNB: it is run at the end of the task so any after commands that mutate the output files/dotenv file will essentially overwrite anything set/outputted as part of the main command\n\n```go\ntype ArtifactType string\n```\n\n```go\nconst (\n\tFileArtifactType   ArtifactType = \"file\"\n\tDotEnvArtifactType ArtifactType = \"dotenv\"\n)\n```\n\n```go\ntype Task struct {\n\tCommands     []string // Commands to run\n\tContext      string\n\tEnv          variables.Container\n\tVariables    variables.Container\n\tVariations   []map[string]string\n\tDir          string\n\tTimeout      *time.Duration\n\tAllowFailure bool\n\tAfter        []string\n\tBefore       []string\n\tInteractive  bool\n\t// ResetContext is useful if multiple variations are running in the same task\n\tResetContext bool\n\tCondition    string\n\tSkipped      bool\n\n\tName        string\n\tDescription string\n\n\tStart time.Time\n\tEnd   time.Time\n\n\tArtifacts *Artifact\n\n\tExitCode int16\n\tErrored  bool\n\tError    error\n\tLog      struct {\n\t\tStderr *bytes.Buffer\n\t\tStdout *bytes.Buffer\n\t}\n}\n```\nTask is a structure that describes task, its commands, environment, working directory etc. After task completes it provides task's execution status, exit code, stdout and stderr\n\n```go\nfunc FromCommands(name string, commands ...string) *Task\n```\nFromCommands creates task new Task instance with given commands\n\n```go\nfunc NewTask(name string) *Task\n```\nNewTask creates new Task instance\n\n```go\nfunc (t *Task) Duration() time.Duration\n```\nDuration returns task's execution duration\n\n```go\nfunc (t *Task) ErrorMessage() string\n```\nErrorMessage returns message of the error occurred during task execution\n\n```go\nfunc (t *Task) GetVariations() []map[string]string\n```\nGetVariations returns array of maps which are task's variations if no variations exist one is returned to create the default job\n\n```go\nfunc (t *Task) Output() string\n```\nOutput returns task's stdout as a string\n\n```go\nfunc (t *Task) WithEnv(key, value string) *Task\n```\nWithEnv sets environment variable\n\n","path":"github.com/Ensono/taskctl/pkg/task","name":"task","synopsis":"","isRedistributable":true}
