manager

package
v0.0.0-...-95e5691 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Err                 = errors.New("")
	ErrVersion          = fmt.Errorf("%w", Err)
	ErrNoCurrentVersion = fmt.Errorf("%w", ErrVersion)
	ErrVersionNotFound  = fmt.Errorf("%w", ErrVersion)
	ErrBinNotFound      = fmt.Errorf("%w", ErrVersion)
)
View Source
var ErrConfig = fmt.Errorf("%w", Err)

Functions

This section is empty.

Types

type Config

type Config struct {
	Mode    Mode          `yaml:"mode" json:"mode"`
	Current CurrentConfig `yaml:"current" json:"current"`
	Paths   PathsConfig   `yaml:"paths" json:"paths"`
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) PopulateCurrent

func (conf *Config) PopulateCurrent() error

type ConfigFile

type ConfigFile struct {
	Paths ConfigFilePaths `yaml:"paths" json:"paths"`
}

type ConfigFilePaths

type ConfigFilePaths struct {
	Shims    string `yaml:"shims" json:"shims" env:"EVM_SHIMS,overwrite"`
	Sources  string `yaml:"sources" json:"sources"  env:"EVM_SOURCES,overwrite"`
	Versions string `yaml:"versions" json:"versions" env:"EVM_VERSIONS,overwrite"`
}

type CurrentConfig

type CurrentConfig struct {
	Version string `yaml:"version" json:"version"`
	SetBy   string `yaml:"set_by,omitempty" json:"set_by,omitempty"`
}

type Manager

type Manager struct {
	Config *Config
}

func New

func New(config *Config) (*Manager, error)

func (*Manager) CurrentSetBy

func (m *Manager) CurrentSetBy() string

func (*Manager) CurrentVersion

func (m *Manager) CurrentVersion() string

func (*Manager) Exec

func (m *Manager) Exec(
	ctx context.Context,
	program string,
	args []string,
) error

func (*Manager) ExecVersion

func (m *Manager) ExecVersion(
	ctx context.Context,
	version string,
	program string,
	args []string,
) error

func (*Manager) FindBin

func (m *Manager) FindBin(
	ctx context.Context,
	name string,
) ([]*Version, error)

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, version string) (*Version, error)

func (*Manager) List

func (m *Manager) List(ctx context.Context) ([]*Version, error)

func (*Manager) ListShims

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

func (*Manager) RehashAll

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

func (*Manager) RehashVersions

func (m *Manager) RehashVersions(
	ctx context.Context,
	versions []string,
) error

func (*Manager) Use

func (m *Manager) Use(ctx context.Context, version string) error

type Mode

type Mode string
const (
	User   Mode = "user"
	System Mode = "system"
)

type PathsConfig

type PathsConfig struct {
	Binary   string `yaml:"binary" json:"binary"`
	Root     string `yaml:"root" json:"root"`
	Shims    string `yaml:"shims" json:"shims"`
	Sources  string `yaml:"sources" json:"sources"`
	Versions string `yaml:"versions" json:"versions"`
}

type Version

type Version struct {
	Version  string   `yaml:"version" json:"version"`
	Current  bool     `yaml:"current" json:"current"`
	Path     string   `yaml:"path" json:"path"`
	BinDir   string   `yaml:"bin_dir" json:"bin_dir"`
	Binaries []string `yaml:"binaries" json:"binaries"`
}

func (*Version) FindBin

func (ver *Version) FindBin(name string) (string, error)

Jump to

Keyboard shortcuts

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