Documentation
¶
Index ¶
- Constants
- Variables
- func IsPossible(j Job) (bool, error)
- func PrintDryRunTag()
- func PrintHeader(j Job, next *time.Time)
- func PrintSuccessful(message string, duration *time.Duration)
- func PrintUnsuccessful(message string, duration *time.Duration)
- func Timeago(date time.Time) string
- type ExecutionOptions
- type ExecutionPlan
- type Factory
- type FeedDownloadJob
- func (x *FeedDownloadJob) Execute(options ExecutionOptions) error
- func (x FeedDownloadJob) IsPossible() (bool, error)
- func (x *FeedDownloadJob) Metadata() Metadata
- func (x *FeedDownloadJob) Post() error
- func (x *FeedDownloadJob) Pre() error
- func (x *FeedDownloadJob) WithFilename(filename string) *FeedDownloadJob
- type HTTPDownloadJob
- func (x *HTTPDownloadJob) Execute(options ExecutionOptions) error
- func (x HTTPDownloadJob) IsPossible() (bool, error)
- func (x *HTTPDownloadJob) Metadata() Metadata
- func (x *HTTPDownloadJob) Post() error
- func (x *HTTPDownloadJob) Pre() error
- func (x *HTTPDownloadJob) WithFilename(filename string) *HTTPDownloadJob
- type ImpossibleJobError
- type Job
- type Metadata
- type OpenJob
- type Pool
- func (x *Pool) AddJob(job Job) *Pool
- func (x *Pool) AttendedOnly() *Pool
- func (x *Pool) ByWeight() *Pool
- func (x *Pool) EnabledOnly() *Pool
- func (x *Pool) Jobs() []Job
- func (x Pool) NeedsSudo() bool
- func (x *Pool) PossibleOnly() *Pool
- func (x *Pool) PossibleOrFixableOnly() *Pool
- func (x *Pool) RequiredOnly(next func(j Job) time.Time) *Pool
- func (x *Pool) SortedBy(lessFunc func(j1, j2 Job) bool) *Pool
- func (x *Pool) UnattendedOnly() *Pool
- type ShellJob
- type TextJob
Constants ¶
View Source
const DateFormat = "02.01.2006 15:04 Uhr"
Variables ¶
View Source
var ErrInvalidExecutionPlan = errors.New("not a valid ExecutionPlan")
Functions ¶
func IsPossible ¶
func PrintDryRunTag ¶
func PrintDryRunTag()
func PrintHeader ¶
func PrintSuccessful ¶
func PrintUnsuccessful ¶
Types ¶
type ExecutionOptions ¶
type ExecutionOptions struct {
ExecutionPlan ExecutionPlan
Delay bool
Wait bool
DryRun bool
Verbose bool
}
type ExecutionPlan ¶
type ExecutionPlan uint8
ENUM(skip, logDone, execute)
const ( // ExecutionPlanSkip is a ExecutionPlan of type Skip. ExecutionPlanSkip ExecutionPlan = iota // ExecutionPlanLogDone is a ExecutionPlan of type LogDone. ExecutionPlanLogDone // ExecutionPlanExecute is a ExecutionPlan of type Execute. ExecutionPlanExecute )
func ParseExecutionPlan ¶
func ParseExecutionPlan(name string) (ExecutionPlan, error)
ParseExecutionPlan attempts to convert a string to a ExecutionPlan.
func (ExecutionPlan) IsValid ¶
func (x ExecutionPlan) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ExecutionPlan) String ¶
func (x ExecutionPlan) String() string
String implements the Stringer interface.
type FeedDownloadJob ¶
type FeedDownloadJob struct {
Meta Metadata `yaml:"metadata"`
RemoteURL string `yaml:"remote-url"`
LocalDir string `yaml:"local-dir"`
}
func LoadFeedDownloadJobFromFile ¶
func LoadFeedDownloadJobFromFile(filename string) (*FeedDownloadJob, error)
func (*FeedDownloadJob) Execute ¶
func (x *FeedDownloadJob) Execute(options ExecutionOptions) error
func (FeedDownloadJob) IsPossible ¶
func (x FeedDownloadJob) IsPossible() (bool, error)
func (*FeedDownloadJob) Metadata ¶
func (x *FeedDownloadJob) Metadata() Metadata
func (*FeedDownloadJob) Post ¶
func (x *FeedDownloadJob) Post() error
func (*FeedDownloadJob) Pre ¶
func (x *FeedDownloadJob) Pre() error
func (*FeedDownloadJob) WithFilename ¶
func (x *FeedDownloadJob) WithFilename(filename string) *FeedDownloadJob
type HTTPDownloadJob ¶
type HTTPDownloadJob struct {
Meta Metadata `yaml:"metadata"`
Files []struct {
RemoteURL string `yaml:"remote-url"`
LocalDir string `yaml:"local-dir"`
LocalFilename string `yaml:"local-filename"`
} `yaml:"files"`
}
func LoadHTTPDownloadJobFromFile ¶
func LoadHTTPDownloadJobFromFile(filename string) (*HTTPDownloadJob, error)
func (*HTTPDownloadJob) Execute ¶
func (x *HTTPDownloadJob) Execute(options ExecutionOptions) error
func (HTTPDownloadJob) IsPossible ¶
func (x HTTPDownloadJob) IsPossible() (bool, error)
func (*HTTPDownloadJob) Metadata ¶
func (x *HTTPDownloadJob) Metadata() Metadata
func (*HTTPDownloadJob) Post ¶
func (x *HTTPDownloadJob) Post() error
func (*HTTPDownloadJob) Pre ¶
func (x *HTTPDownloadJob) Pre() error
func (*HTTPDownloadJob) WithFilename ¶
func (x *HTTPDownloadJob) WithFilename(filename string) *HTTPDownloadJob
type ImpossibleJobError ¶
type ImpossibleJobError struct {
// contains filtered or unexported fields
}
func NewImpossibleJobError ¶
func NewImpossibleJobError(err error, fixable bool) ImpossibleJobError
func NewImpossibleJobErrorFromProcessResult ¶
func NewImpossibleJobErrorFromProcessResult(result *script.ProcessResult) ImpossibleJobError
func (*ImpossibleJobError) As ¶
func (x *ImpossibleJobError) As(t any) bool
func (ImpossibleJobError) Error ¶
func (x ImpossibleJobError) Error() string
func (*ImpossibleJobError) Is ¶
func (x *ImpossibleJobError) Is(target error) bool
func (ImpossibleJobError) IsFixable ¶
func (x ImpossibleJobError) IsFixable() bool
func (ImpossibleJobError) Unwrap ¶
func (x ImpossibleJobError) Unwrap() error
type Metadata ¶
type Metadata struct {
JobType string `yaml:"type"`
Filename string
Name string `yaml:"name,omitempty"`
Description string `yaml:"description,omitempty"`
Unattended *bool `yaml:"unattended,omitempty"`
Enabled *bool `yaml:"enabled,omitempty"`
Next string `yaml:"next,omitempty"`
Possible []string `yaml:"possible,omitempty"`
Sudo *bool `yaml:"sudo,omitempty"`
Timeout time.Duration // TODO implement
Weight *int `yaml:"weight,omitempty"`
Output string `yaml:"output,omitempty"`
Pre struct {
Command string `yaml:"command,omitempty"`
} `yaml:"pre,omitempty"`
Post struct {
Command string `yaml:"command,omitempty"`
} `json:"post,omitempty"`
}
func (Metadata) IsDisabled ¶
func (Metadata) IsUnattended ¶
type OpenJob ¶
type OpenJob struct {
Meta Metadata `yaml:"metadata"`
Wait bool `yaml:"wait,omitempty"`
Targets []string `yaml:"targets"`
}
func LoadOpenJobFromFile ¶
func (*OpenJob) Execute ¶
func (x *OpenJob) Execute(options ExecutionOptions) error
func (OpenJob) IsPossible ¶
func (*OpenJob) WithFilename ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewJobPool ¶
func NewJobPool() *Pool
func NewJobPoolWithJobs ¶
func (*Pool) AttendedOnly ¶
func (*Pool) EnabledOnly ¶
func (*Pool) PossibleOnly ¶
func (*Pool) PossibleOrFixableOnly ¶
func (*Pool) UnattendedOnly ¶
type ShellJob ¶
type ShellJob struct {
Meta Metadata `yaml:"metadata"`
Wait bool `yaml:"wait"`
Exec string `yaml:"execute"`
ExecDryRun string `yaml:"execute-dry-run,omitempty"`
}
func LoadShellJobFromFile ¶
func (*ShellJob) Execute ¶
func (x *ShellJob) Execute(options ExecutionOptions) error
func (ShellJob) IsPossible ¶
func (*ShellJob) WithFilename ¶
type TextJob ¶
type TextJob struct {
Meta Metadata `yaml:"metadata"`
Wait bool `yaml:"wait,omitempty"`
Text string `yaml:"text,omitempty"`
}
func LoadTextJobFromFile ¶
func (*TextJob) Execute ¶
func (x *TextJob) Execute(options ExecutionOptions) error
func (TextJob) IsPossible ¶
func (*TextJob) WithFilename ¶
Click to show internal directories.
Click to hide internal directories.