plugin

package
v3.9.1-2869 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Information

func Information(name string) (string, error)

Information gets the information about an installed plugin

func IsPredefined

func IsPredefined(name string) bool

func List

func List() (string, error)

List gets a list of all installed plugins

func RunWithURL

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

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

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

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

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

type Selector

type Selector struct {
	OS   string
	Arch string
}

Selector represents the environment.

type Wait

type Wait func() error

func Start

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