tasks

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tasks contains an abstraction of tasks and their state. The task abstraction breaks the coupling between functions that perform a composite task and feedback to a user about the progress of each step of the composite task.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	ErrorExitCode int
	Output        io.Writer
	Error         io.Writer
	// contains filtered or unexported fields
}

The Task struct holds the necessary information to produce output for users that execute a multi-step process.

func (Task) FatalIff

func (t Task) FatalIff(condition bool, format string, args ...interface{})

FatalIff is a function that logs any string to system err and causes the application to exit, if a condition matches. It provides the same formatting as the fmt package does.

func (Task) FatalOnError

func (t Task) FatalOnError(err error)

FatalOnError is a function that logs any error to system err and causes the application to exit, if a condition matches.

func (Task) Fatalf

func (t Task) Fatalf(format string, args ...interface{})

Fatalf is a function that logs any string to system err and causes the application to exit. It provides the same formatting as the fmt package does.

func (Task) Printf

func (t Task) Printf(format string, args ...interface{})

Printf is a function that logs any string to system out. It provides the same formatting as the fmt package does.

func (Task) Step

func (t Task) Step() *Task

Step is a function that returns a sub-task for of the receiving Task.

func (Task) Track

func (t Task) Track(description string, workload func() error) error

Track is a function that logs the tracked status of a given workload function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL