plugin

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 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) MarshalYAML

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

MarshalYAML satisfies yaml.Marshaler.

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.

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"`
}

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.

Jump to

Keyboard shortcuts

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