languages

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasInstall

func HasInstall(ctx context.Context, language core.Language, version goversion.Version) (error, bool)

HasInstall the Check if it is installed

func NormalizeLayout

func NormalizeLayout(destDir, targetDir string, execNames []string) error

NormalizeLayout 扁平化解压目录并将目标可执行移动/定位到指定子路径。 destDir: 版本根目录 targetDir: 相对 destDir 的目录(如 "bin",根目录则传 "") execNames: 期望出现的可执行文件名列表(按顺序尝试)

Types

type Language

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

Language 默认方法

func NewLanguage

func NewLanguage(lang core.Language) *Language

func (*Language) GetDefaultVersion

func (l *Language) GetDefaultVersion() *core.InstalledVersion

func (*Language) ListInstalledVersions

func (l *Language) ListInstalledVersions(ctx context.Context, binPath string) ([]*core.InstalledVersion, error)

func (*Language) SetDefaultVersion

func (l *Language) SetDefaultVersion(ctx context.Context, version string, envs []env.KV) error

func (*Language) Uninstall

func (l *Language) Uninstall(version string) error

type PackageSuffix

type PackageSuffix string
const (
	Tar PackageSuffix = ".tar.gz"
	Zip PackageSuffix = ".zip"
	Pkg PackageSuffix = ".pkg"
)

func (PackageSuffix) Composition

func (p PackageSuffix) Composition(name string) string

func (PackageSuffix) String

func (p PackageSuffix) String() string

type PackageSuffixes

type PackageSuffixes []PackageSuffix
var AllSuffix PackageSuffixes = []PackageSuffix{Tar, Zip, Pkg}

func (PackageSuffixes) GetSuffix

func (p PackageSuffixes) GetSuffix(packageName string) PackageSuffix

func (PackageSuffixes) Has

func (p PackageSuffixes) Has(packageName string) bool

func (PackageSuffixes) Trim

func (p PackageSuffixes) Trim(packageName string) string

type PreReleaseError

type PreReleaseError struct {
	Language          string   // 语言名称
	RequestedVersion  string   // 用户请求的版本
	AvailableVersions []string // 可用的候选版本
}

PreReleaseError 预发布版本错误类型

func (*PreReleaseError) Error

func (e *PreReleaseError) Error() string

func (*PreReleaseError) GetRecommendedVersion

func (e *PreReleaseError) GetRecommendedVersion() string

GetRecommendedVersion 获取推荐的候选版本(通常是最新的)

Source Files

  • errors.go
  • helpers.go
  • language.go
  • layout.go
  • type.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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