plugin

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Information added in v0.21.3

func Information(name string) (string, error)

Information gets the information about an installed plugin

func IsPredefined added in v0.30.3

func IsPredefined(name string) bool

func List added in v0.21.3

func List() (string, error)

List gets a list of all installed plugins

func RunWithURL added in v0.48.0

func RunWithURL(ctx context.Context, url string, opts RunOptions) error

RunWithURL runs the plugin with URL

func Uninstall

func Uninstall(name string) error

Uninstall installs the plugin

func Update added in v0.21.3

func Update(name string) error

Update updates an existing plugin

Types

type Platform

type Platform struct {
	Selector *Selector
	URI      string
	Bin      string
}

Platform represents where the execution file exists per platform.

type Plugin

type Plugin struct {
	Name        string     `yaml:"name"`
	Repository  string     `yaml:"repository"`
	Version     string     `yaml:"version"`
	Usage       string     `yaml:"usage"`
	Description string     `yaml:"description"`
	Platforms   []Platform `yaml:"platforms"`

	// runtime environment for testability
	GOOS   string `yaml:"_goos"`
	GOARCH string `yaml:"_goarch"`
}

Plugin represents a plugin.

func Install

func Install(ctx context.Context, url string, force bool) (Plugin, error)

Install installs a plugin

func LoadAll

func LoadAll() ([]Plugin, error)

LoadAll loads all plugins

func (Plugin) Cmd added in v0.48.0

func (p Plugin) Cmd(ctx context.Context, opts RunOptions) (*exec.Cmd, error)

func (Plugin) Run

func (p Plugin) Run(ctx context.Context, opts RunOptions) error

Run runs the plugin

func (Plugin) Start added in v0.48.0

func (p Plugin) Start(ctx context.Context, opts RunOptions) (Wait, error)

Start starts the plugin

After a successful call to Start the Wait method must be called.

type RunOptions added in v0.48.0

type RunOptions struct {
	Args  []string
	Stdin io.Reader
}

type Selector

type Selector struct {
	OS   string
	Arch string
}

Selector represents the environment.

type Wait added in v0.48.0

type Wait func() error

func Start added in v0.48.0

func Start(ctx context.Context, name string, opts RunOptions) (Wait, error)

Start starts the plugin

Jump to

Keyboard shortcuts

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