asdf

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package asdf provides a simple interface to the asdf version manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install() error

Install installs all plugins and versions specified in local and global .tool-versions file.

func InstallPlugins

func InstallPlugins(pluginsToInstall ...string) error

InstallPlugins installs given plugins and version specified in local .tool-versions file or latest version if not specified.

func ListPluginVersions

func ListPluginVersions(plugin string) ([]string, error)

ListPluginVersions lists all installed versions of software for the specified plugin in ascending order.

func Upgrade

func Upgrade() error

Upgrade upgrades all plugins and versions specified in local .tool-versions file.

Types

type PluginVersions

type PluginVersions map[string]Version

PluginVersions is a map of plugin name and version.

func ParseToolVersions

func ParseToolVersions() (PluginVersions, error)

ParseToolVersions parses .tool-versions file and returns a map of plugin name and version.

func (PluginVersions) GetVersionOrDefault

func (p PluginVersions) GetVersionOrDefault(plugin, withPrefix, defaultVersion string) string

GetVersionOrDefault returns the version of the plugin with given prefix if it exists in the map, otherwise returns the default version.

withPrefix is used to specify the prefix of the plugin version. For example, if the plugin version is 1.2.3, then withPrefix is `v` and the returned version will be `v1.2.3`. If withPrefix is empty, then the returned version will be `1.2.3`. This is useful when the plugin version is prefixed with a `v` and the plugin doesn't support it.

WithPrefix only applies to the returned version, not applied the default version.

type Plugins

type Plugins map[string]bool

Plugins is a simple custom type to hold plugin name to quickly check if a plugin is already added.

func ListPlugins

func ListPlugins() (Plugins, error)

ListPlugins lists all plugins installed in asdf.

type Version

type Version struct {
	// Plugin version
	Version string

	// If true, plugin version should be ignored during upgrade
	VersionFreeze bool
}

Version is a simple struct to holds plugin version information.

Jump to

Keyboard shortcuts

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