plugin

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 20 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) error

func List added in v0.21.3

func List(ctx context.Context) error

func Run added in v0.52.0

func Run(ctx context.Context, name string, opts Options) error
func Search(ctx context.Context, keyword string) error

func Uninstall

func Uninstall(ctx context.Context, name string) error

func Update added in v0.21.3

func Update(ctx context.Context, opts Options) error

func Upgrade added in v0.52.0

func Upgrade(ctx context.Context, names []string) error

Types

type Index added in v0.52.0

type Index struct {
	Version int `yaml:"version"`
	Plugins []struct {
		Name       string `yaml:"name"`
		Version    string `yaml:"version"`
		Maintainer string `yaml:"maintainer"`
		Summary    string `yaml:"summary"`
		Repository string `yaml:"repository"`
		Output     bool   `yaml:"output"`
	} `yaml:"plugins"`
}

type Input added in v0.52.0

type Input struct {
	// contains filtered or unexported fields
}

Input represents the user-specified Input.

func (*Input) String added in v0.52.0

func (i *Input) String() string

type Installed added in v0.52.0

type Installed struct {
	Platform Selector `yaml:"platform"`
}

type Manager added in v0.52.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages the plugins

func NewManager added in v0.52.0

func NewManager(opts ...ManagerOption) *Manager

func (*Manager) Information added in v0.52.0

func (m *Manager) Information(name string) error

Information gets the information about an installed plugin

func (*Manager) Install added in v0.52.0

func (m *Manager) Install(ctx context.Context, arg string, opts Options) (Plugin, error)

Install installs a plugin

func (*Manager) List added in v0.52.0

func (m *Manager) List(ctx context.Context) error

List gets a list of all installed plugins

func (*Manager) LoadAll added in v0.52.0

func (m *Manager) LoadAll(ctx context.Context) ([]Plugin, error)

LoadAll loads all plugins

func (*Manager) Run added in v0.52.0

func (m *Manager) Run(ctx context.Context, name string, opts Options) error

Run installs and runs the plugin

func (*Manager) Search added in v0.52.0

func (m *Manager) Search(ctx context.Context, keyword string) error

func (*Manager) Start added in v0.52.0

func (m *Manager) Start(ctx context.Context, name string, opts Options) (Wait, error)

Start starts the plugin

func (*Manager) Uninstall added in v0.52.0

func (m *Manager) Uninstall(ctx context.Context, name string) error

Uninstall installs the plugin

func (*Manager) Update added in v0.52.0

func (m *Manager) Update(ctx context.Context, opts Options) error

func (*Manager) Upgrade added in v0.52.0

func (m *Manager) Upgrade(ctx context.Context, names []string) error

Upgrade upgrades an existing plugins

type ManagerOption added in v0.52.0

type ManagerOption func(indexer *Manager)

func WithIndexURL added in v0.52.0

func WithIndexURL(indexURL string) ManagerOption

func WithLogger added in v0.52.0

func WithLogger(logger *log.Logger) ManagerOption

func WithWriter added in v0.52.0

func WithWriter(w io.Writer) ManagerOption

type Options added in v0.52.0

type Options struct {
	Args     []string
	Stdin    io.Reader // For output plugin
	Platform ftypes.Platform
	Insecure bool
}

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"`
	Summary     string     `yaml:"summary"`
	Usage       string     `yaml:"usage"` // Deprecated: Use summary instead
	Description string     `yaml:"description"`
	Platforms   []Platform `yaml:"platforms"`

	// Installed holds the metadata about installation
	Installed Installed `yaml:"installed"`
	// contains filtered or unexported fields
}

Plugin represents a plugin.

func Install

func Install(ctx context.Context, name string, opts Options) (Plugin, error)

func (*Plugin) Cmd added in v0.48.0

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

func (*Plugin) Dir added in v0.52.0

func (p *Plugin) Dir() string

func (*Plugin) Run

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

Run runs the plugin

func (*Plugin) Start added in v0.48.0

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

Start starts the plugin

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

type Selector

type Selector struct {
	OS   string `yaml:"os"`
	Arch string `yaml:"arch"`
}

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 Options) (Wait, error)

Jump to

Keyboard shortcuts

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