chores

package module
v0.0.0-...-857e95b Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OUTPUT_OUT int = 1 << iota
	OUTPUT_ERR
)

Variables

This section is empty.

Functions

func Execute

func Execute(choreList []Chore) error

Execute executes a list of chores supplied outputting status on stdout.

Types

type BasicChore

type BasicChore struct {
	// contains filtered or unexported fields
}

func (*BasicChore) Description

func (c *BasicChore) Description() string

func (*BasicChore) Execute

func (c *BasicChore) Execute() ChoreState

func (*BasicChore) Name

func (c *BasicChore) Name() string

func (*BasicChore) Necessary

func (c *BasicChore) Necessary() bool

func (*BasicChore) Possible

func (c *BasicChore) Possible() bool

func (*BasicChore) SetDescription

func (c *BasicChore) SetDescription(description string)

func (*BasicChore) SetExec

func (c *BasicChore) SetExec(exec func() ChoreState)

func (*BasicChore) SetName

func (c *BasicChore) SetName(name string)

type Chore

type Chore interface {
	Name() string
	SetName(name string)
	Description() string
	SetDescription(description string)

	Execute() ChoreState

	Possible() bool
	Necessary() bool
}

type ChoreState

type ChoreState int

ChoreState is telling the chore result.

const (
	// StateSuccess constant
	StateSuccess ChoreState = iota
	// StateWarning constant
	StateWarning
	// StateError constant
	StateError
)

type CommandChore

type CommandChore struct {
	BasicChore

	Command     []string
	WorkingDir  string
	Frequency   string
	Output      int
	SuccessFunc func(*script.ProcessResult) bool
	// contains filtered or unexported fields
}

CommandChore is a chore based on a cli command to be executed.

func NewCommandChore

func NewCommandChore() (chore *CommandChore)

NewCommandChore returns a new command based chore.

func (*CommandChore) Context

func (c *CommandChore) Context() *script.Context

Context returns the CommandChore's script.Context

func (*CommandChore) Execute

func (c *CommandChore) Execute() (choreState ChoreState)

Execute executes a single chore.

Jump to

Keyboard shortcuts

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