shims

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: 16 Imported by: 0

Documentation

Overview

Package shims manages writing and parsing of asdf shim scripts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Directory

func Directory(conf config.Config) string

Directory returns the path to the shims directory for the current configuration.

func ExecutableDirs

func ExecutableDirs(plugin plugins.Plugin) ([]string, error)

ExecutableDirs returns a slice of directory names that tool executables are contained in

func ExecutableOnPath

func ExecutableOnPath(path, command string) (string, error)

ExecutableOnPath returns the path to an executable if one is found on the provided paths. `path` must be in the same format as the `PATH` environment variable.

func ExecutablePaths

func ExecutablePaths(conf config.Config, plugin plugins.Plugin, version toolversions.Version) ([]string, error)

ExecutablePaths returns a slice of absolute directory paths that tool executables are contained in.

func FindExecutable

func FindExecutable(conf config.Config, shimName, currentDirectory string) (string, plugins.Plugin, string, bool, error)

FindExecutable takes a shim name and a current directory and returns the path to the executable that the shim resolves to.

func GenerateAll

func GenerateAll(conf config.Config, stdOut io.Writer, stdErr io.Writer) error

GenerateAll generates shims for all executables of every version of every plugin.

func GenerateForPluginVersions

func GenerateForPluginVersions(conf config.Config, plugin plugins.Plugin, stdOut io.Writer, stdErr io.Writer) error

GenerateForPluginVersions generates all shims for all installed versions of a tool.

func GenerateForVersion

func GenerateForVersion(conf config.Config, plugin plugins.Plugin, version toolversions.Version, stdOut io.Writer, stdErr io.Writer) error

GenerateForVersion loops over all the executable files found for a tool and generates a shim for each one

func GetExecutablePath

func GetExecutablePath(conf config.Config, plugin plugins.Plugin, shimName string, version toolversions.Version) (string, error)

GetExecutablePath returns the path of the executable

func GetToolsAndVersionsFromShimFile

func GetToolsAndVersionsFromShimFile(shimPath string) (versions []toolversions.ToolVersions, err error)

GetToolsAndVersionsFromShimFile takes a file path and parses out the tools and versions present in it and returns them as a slice containing info in ToolVersions structs.

func Path

func Path(conf config.Config, shimName string) string

Path returns the path for a shim script

func RemoveAll

func RemoveAll(conf config.Config) error

RemoveAll removes all shim scripts

func SystemExecutableOnPath

func SystemExecutableOnPath(conf config.Config, executableName string) (string, bool)

SystemExecutableOnPath returns the path to the system executable if found, removes asdf shim directory from search

func ToolExecutables

func ToolExecutables(conf config.Config, plugin plugins.Plugin, version toolversions.Version) (executables []string, err error)

ToolExecutables returns a slice of executables for a given tool version

func Write

func Write(conf config.Config, plugin plugins.Plugin, version toolversions.Version, executablePath string) error

Write generates a shim script and writes it to disk

Types

type NoExecutableForPluginError

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

NoExecutableForPluginError is returned when a compatible version is found but no executable matching the name is located.

func (NoExecutableForPluginError) Error

type NoVersionSetError

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

NoVersionSetError is returned when shim is found but no version matches

func (NoVersionSetError) Error

func (e NoVersionSetError) Error() string

type UnknownCommandError

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

UnknownCommandError is an error returned when a shim is not found

func (UnknownCommandError) Error

func (e UnknownCommandError) Error() string

Jump to

Keyboard shortcuts

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