Documentation
¶
Overview ¶
Package toolversions handles reading and writing tools and versions from asdf's .tool-versions files. It also handles parsing version strings from .tool-versions files and command line arguments.
Index ¶
- func FindToolVersions(filepath, toolName string) (versions []string, found bool, err error)
- func Format(version Version) string
- func FormatForFS(version Version) string
- func Intersect(versions1 []string, versions2 []string) (versions []string)
- func VersionStringFromFSFormat(version string) string
- func WriteToolVersionsToFile(filepath string, toolVersions []ToolVersions) error
- type ToolVersions
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindToolVersions ¶
FindToolVersions looks up a tool version in a tool versions file and if found returns a slice of versions for it.
func FormatForFS ¶
FormatForFS takes a versionType and version strings and generate a version string suitable for the file system
func Intersect ¶
Intersect takes two slices of versions and returns a new slice containing only the versions found in both.
func VersionStringFromFSFormat ¶ added in v0.17.0
VersionStringFromFSFormat takes a version string from directory name and formats it as version string that can be parsed by the Parse function.
func WriteToolVersionsToFile ¶
func WriteToolVersionsToFile(filepath string, toolVersions []ToolVersions) error
WriteToolVersionsToFile takes a path to a file and writes the new tool and version data to the file. It creates the file if it does not exist and updates it if it does.
Types ¶
type ToolVersions ¶
ToolVersions represents a tool along with versions specified for it
func GetAllToolsAndVersions ¶
func GetAllToolsAndVersions(filepath string) (toolVersions []ToolVersions, err error)
GetAllToolsAndVersions returns a list of all tools and associated versions contained in a .tool-versions file
func Unique ¶
func Unique(versions []ToolVersions) (uniques []ToolVersions)
Unique takes a slice of ToolVersions and returns a slice of unique tools and versions.
type Version ¶
type Version struct {
Type string // Must be one of: version, ref, path, system, latest
Value string // Any string
}
Version struct represents a single version in asdf.
func ParseFromCliArg ¶
ParseFromCliArg parses a string that is passed in as an argument to one of the asdf subcommands. Some subcommands allow the special version `latest` to be used, with an optional filter string.
func ParseSlice ¶
ParseSlice takes a slice of strings and returns a slice of parsed versions.