plugin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Overview

Package plugin provides functionalities for reading plugin configuration.

Index

Constants

View Source
const (
	// MetadataFile is the plugin metadata file.
	MetadataFile = ".plugin.registry.yaml"
)

Variables

View Source
var ErrPluginNotExist = errors.New("plugin does not exist")

ErrPluginNotExist indicates that the plugin does not exist.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	File string `yaml:"file"`
}

Artifact represents all information about an artifact of a plugin.

type ArtifactIdentifier

type ArtifactIdentifier struct {
	OS   string
	Arch string
}

ArtifactIdentifier represents information to identify an artifact.

func NewArtifactIdentifier

func NewArtifactIdentifier(os, arch string) ArtifactIdentifier

NewArtifactIdentifier creates a new ArtifactIdentifier.

func RuntimeArtifactIdentifier

func RuntimeArtifactIdentifier() ArtifactIdentifier

RuntimeArtifactIdentifier returns the system's identifier.

func RuntimeArtifactIdentifierWithoutArch

func RuntimeArtifactIdentifierWithoutArch() ArtifactIdentifier

RuntimeArtifactIdentifierWithoutArch returns the system's identifier without arch.

func (ArtifactIdentifier) String

func (a ArtifactIdentifier) String() string

String satisfies fmt.Stringer.

func (*ArtifactIdentifier) UnmarshalYAML

func (a *ArtifactIdentifier) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML satisfies yaml.Unmarshaler.

type Artifacts

type Artifacts map[ArtifactIdentifier]Artifact

Artifacts is a map of Artifact, identified by os and arch.

func (*Artifacts) Has

func (a *Artifacts) Has(id ArtifactIdentifier) bool

Has checks whether the artifact is in the list.

func (Artifacts) MarshalYAML added in v0.1.6

func (a Artifacts) MarshalYAML() (interface{}, error)

MarshalYAML satisfies yaml.Marshaler.

type Plugin

type Plugin struct {
	Name        string    `yaml:"name"`
	URL         string    `yaml:"url"`
	Version     string    `yaml:"version"`
	Description string    `yaml:"description"`
	Enabled     bool      `yaml:"enabled"`
	Hidden      bool      `yaml:"hidden"`
	Artifacts   Artifacts `yaml:"artifacts"`
	Tags        Tags      `yaml:"tags"`
}

Plugin represents metadata of a plugin.

func Load

func Load(fs afero.Fs, path string) (*Plugin, error)

Load loads plugin metadata.

func (*Plugin) ResolveArtifact

func (p *Plugin) ResolveArtifact(a Artifact) Artifact

ResolveArtifact replaces all placeholders in artifact definition by real values.

func (*Plugin) RuntimeArtifact

func (p *Plugin) RuntimeArtifact() Artifact

RuntimeArtifact returns the artifact of current arch.

func (*Plugin) UnmarshalYAML

func (p *Plugin) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML satisfies yaml.Unmarshaler.

type Plugins added in v0.1.3

type Plugins map[string]Plugin

Plugins is a map of plugins.

func (Plugins) FilterByTag added in v0.1.3

func (p Plugins) FilterByTag(tag string) Plugins

FilterByTag filter the plugins by tags.

func (Plugins) Has added in v0.1.9

func (p Plugins) Has(name string) bool

Has checks whether the plugin is in the map or not.

type Tags added in v0.1.3

type Tags []string

Tags is a list of string tag.

func (Tags) Contains added in v0.1.3

func (t Tags) Contains(tag string) bool

Contains checks whether a tag is in the list or not.

Jump to

Keyboard shortcuts

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