plugins

package
v0.15.1-0...-a10057d Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package plugins provides functions for interacting with asdf plugins

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(config config.Config, pluginName, pluginURL, ref string) error

Add takes plugin name and Git URL and installs the plugin if it isn't already installed

func PluginExists

func PluginExists(dataDir, pluginName string) (bool, error)

PluginExists returns a boolean indicating whether or not a plugin with the provided name is currently installed

func Remove

func Remove(config config.Config, pluginName string, stdout, stderr io.Writer) error

Remove uninstalls a plugin by removing it from the file system if installed

Types

type NoCallbackError

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

NoCallbackError is an error returned by RunCallback when a callback with particular name does not exist

func (NoCallbackError) Error

func (e NoCallbackError) Error() string

type NoCommandError

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

NoCommandError is an error returned by ExtensionCommandPath when an extension command with the given name does not exist

func (NoCommandError) Error

func (e NoCommandError) Error() string

type Plugin

type Plugin struct {
	Name string
	Dir  string
	Ref  string
	URL  string
}

Plugin struct represents an asdf plugin to all asdf code. The name and dir fields are the most used fields. Ref and Dir only still git info, which is only information and shown to the user at times.

func List

func List(config config.Config, urls, refs bool) (plugins []Plugin, err error)

List takes config and flags for what to return and builds a list of plugins representing the currently installed plugins on the system.

func New

func New(config config.Config, name string) Plugin

New takes config and a plugin name and returns a Plugin struct. It is intended for functions that need to quickly initialize a plugin.

func (Plugin) CallbackPath

func (p Plugin) CallbackPath(name string) (string, error)

CallbackPath returns the full file path to a callback script

func (Plugin) Exists

func (p Plugin) Exists() error

Exists returns a boolean indicating whether or not the plugin exists on disk.

func (Plugin) ExtensionCommandPath

func (p Plugin) ExtensionCommandPath(name string) (string, error)

ExtensionCommandPath returns the path to the plugin's extension command script matching the name if it exists.

func (Plugin) GetExtensionCommands

func (p Plugin) GetExtensionCommands() ([]string, error)

GetExtensionCommands returns a slice of strings representing all available extension commands for the plugin.

func (Plugin) LegacyFilenames

func (p Plugin) LegacyFilenames() (filenames []string, err error)

LegacyFilenames returns a slice of filenames if the plugin contains the list-legacy-filenames callback.

func (Plugin) ParseLegacyVersionFile

func (p Plugin) ParseLegacyVersionFile(path string) (versions []string, err error)

ParseLegacyVersionFile takes a file and uses the parse-legacy-file callback script to parse it if the script is present. Otherwise just reads the file directly. In either case the returned string is split on spaces and a slice of versions is returned.

func (Plugin) RunCallback

func (p Plugin) RunCallback(name string, arguments []string, environment map[string]string, stdOut io.Writer, errOut io.Writer) error

RunCallback invokes a callback with the given name if it exists for the plugin

func (Plugin) Update

func (p Plugin) Update(conf config.Config, ref string, out, errout io.Writer) (string, error)

Update a plugin to a specific ref, or if no ref provided update to latest

type PluginAlreadyExists

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

PluginAlreadyExists is an error returned when the specified plugin already exists

func NewPluginAlreadyExists

func NewPluginAlreadyExists(plugin string) PluginAlreadyExists

NewPluginAlreadyExists generates a new PluginAlreadyExists error instance for a particular plugin

func (PluginAlreadyExists) Error

func (e PluginAlreadyExists) Error() string

type PluginMissing

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

PluginMissing is the error returned when Plugin.Exists is call and the plugin doesn't exist on disk.

func (PluginMissing) Error

func (e PluginMissing) Error() string

Jump to

Keyboard shortcuts

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