plugin

package
v0.0.0-...-cda2eac Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin

func RegisterPlugin(name string, w func() error, opts ...ConfigOption)

Types

type Config

type Config struct {
	Name       string         `yaml:"name" json:"name"`
	ScriptFile string         `yaml:"script_file" json:"script_file"`
	ScriptArgs []string       `yaml:"script_args" json:"script_args"`
	Interval   types.Duration `yaml:"interval" json:"interval"`

	FN func() error `yaml:"-" json:"-"`
}

type ConfigOption

type ConfigOption = func(*Config)

func Interval

func Interval(i time.Duration) ConfigOption

type Configs

type Configs struct {
	Plugins []*Config `yaml:"plugins" json:"plugins"`
}

type Option

type Option func(*Plugins)

func ConfigFile

func ConfigFile(file string) Option

ConfigFile set config file

func Logger

func Logger(l logger.KitLogger) Option

Logger set config logger

func TrellisConfig

func TrellisConfig(config config.Config) Option

TrellisConfig set config repo

type Plugin

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

func (*Plugin) Start

func (p *Plugin) Start() error

func (*Plugin) Stop

func (p *Plugin) Stop()

type Plugins

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

func NewPlugins

func NewPlugins(opts ...Option) (*Plugins, error)

func (*Plugins) ParseFlags

func (p *Plugins) ParseFlags(set *flag.FlagSet)

func (*Plugins) Start

func (p *Plugins) Start() error

func (*Plugins) Stop

func (p *Plugins) Stop()

type Worker

type Worker interface {
	Start() error
	Stop()
}

func NewPlugin

func NewPlugin(c *Config, l logger.KitLogger) (Worker, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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