plugins

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(corpus Plugin)

Register plugin and call Ready() when preload func done

Types

type Arg

type Arg struct {
	Key      string
	Required bool
	Default  string
}

type ParsedArg

type ParsedArg map[string]string

func ValidateArgs

func ValidateArgs(plugin Plugin, args ParsedArg) (ParsedArg, error)

ValidateArgs and setup default values if not present in args

type Plugin

type Plugin struct {
	Name        string
	Version     uint
	Description string

	Args []Arg

	Preload  func() error
	Generate func(args ParsedArg) ([]byte, error)
}

func Get

func Get(name string) (Plugin, error)

Get by name

func GetAll

func GetAll() []Plugin

GetAll return all loaded plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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