base

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginObjKey = "PLUGIN"
	OsType       = "OS_TYPE"
	ArchType     = "ARCH_TYPE"
	Runtime      = "RUNTIME"
)

Variables

View Source
var ErrNoResultProvide = errors.New("no result provided")
View Source
var ErrNoVersionProvided = errors.New("no version number provided")
View Source
var (
	// HookFuncMap is a map of built-in hook functions.
	HookFuncMap = map[string]HookFunc{
		"Available":       {Name: "Available", Required: true, Filename: "available"},
		"PreInstall":      {Name: "PreInstall", Required: true, Filename: "pre_install"},
		"EnvKeys":         {Name: "EnvKeys", Required: true, Filename: "env_keys"},
		"PostInstall":     {Name: "PostInstall", Required: false, Filename: "post_install"},
		"PreUse":          {Name: "PreUse", Required: false, Filename: "pre_use"},
		"ParseLegacyFile": {Name: "ParseLegacyFile", Required: false, Filename: "parse_legacy_file"},
		"PreUninstall":    {Name: "PreUninstall", Required: false, Filename: "pre_uninstall"},
	}
)

Functions

This section is empty.

Types

type AvailableHookCtx

type AvailableHookCtx struct {
	Args []string `json:"args"`
}

type AvailableHookResultItem

type AvailableHookResultItem struct {
	Version string `json:"version"`
	Note    string `json:"note"`

	Addition []*Info `json:"addition"`
}

type CheckSum

type CheckSum struct {
	Sha256 string `json:"sha256"`
	Sha512 string `json:"sha512"`
	Sha1   string `json:"sha1"`
	Md5    string `json:"md5"`
}

func (*CheckSum) Checksum

func (c *CheckSum) Checksum() *util.Checksum

type EnvKeysHookCtx

type EnvKeysHookCtx struct {
	Main *Info `json:"main"`
	// TODO Will be deprecated in future versions
	Path    string           `json:"path"`
	SdkInfo map[string]*Info `json:"sdkInfo"`
}

type EnvKeysHookResultItem

type EnvKeysHookResultItem struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type HookFunc

type HookFunc struct {
	Name     string
	Required bool
	Filename string
}

type Info

type Info struct {
	Name     string            `json:"name"`
	Version  string            `json:"version"`
	Path     string            `json:"path"`
	Headers  map[string]string `json:"headers"`
	Note     string            `json:"note"`
	Checksum *util.Checksum
}

func (*Info) Clone

func (i *Info) Clone() *Info

func (*Info) Label

func (i *Info) Label() string

func (*Info) StoragePath

func (i *Info) StoragePath(parentDir string) string

type Location

type Location int
const (
	OriginalLocation Location = iota
	GlobalLocation
	ShellLocation
)

func (Location) String

func (s Location) String() string

type Package

type Package struct {
	Main      *Info
	Additions []*Info
}

func (*Package) Clone

func (p *Package) Clone() *Package

type ParseLegacyFileHookCtx

type ParseLegacyFileHookCtx struct {
	Filepath             string           `json:"filepath"`
	Filename             string           `json:"filename"`
	GetInstalledVersions func() []Version `json:"getInstalledVersions"`
}

type ParseLegacyFileResult

type ParseLegacyFileResult struct {
	Version Version `json:"version"`
}

type Plugin

type Plugin interface {
	Available(ctx *AvailableHookCtx) ([]*AvailableHookResultItem, error)

	PreInstall(ctx *PreInstallHookCtx) (*PreInstallHookResult, error)
	PostInstall(ctx *PostInstallHookCtx) error
	PreUninstall(ctx *PreUninstallHookCtx) error
	PreUse(ctx *PreUseHookCtx) (*PreUseHookResult, error)

	ParseLegacyFile(ctx *ParseLegacyFileHookCtx) (*ParseLegacyFileResult, error)
	EnvKeys(ctx *EnvKeysHookCtx) ([]*EnvKeysHookResultItem, error)

	HasFunction(name string) bool
	Close()
}

type PluginInfo

type PluginInfo struct {
	Name              string   `json:"name"`
	Version           string   `json:"version"`
	Description       string   `json:"description"`
	UpdateUrl         string   `json:"updateUrl"`
	ManifestUrl       string   `json:"manifestUrl"`
	Homepage          string   `json:"homepage"`
	License           string   `json:"license"`
	MinRuntimeVersion string   `json:"minRuntimeVersion"`
	Notes             []string `json:"notes"`
	LegacyFilenames   []string `json:"legacyFilenames"`
}

type PostInstallHookCtx

type PostInstallHookCtx struct {
	RootPath string           `json:"rootPath"`
	SdkInfo  map[string]*Info `json:"sdkInfo"`
}

type PreInstallHookCtx

type PreInstallHookCtx struct {
	Version string `json:"version"`
}

type PreInstallHookResult

type PreInstallHookResult struct {
	Version  string                              `json:"version"`
	Url      string                              `json:"url"`
	Headers  map[string]string                   `json:"headers"`
	Note     string                              `json:"note"`
	Sha256   string                              `json:"sha256"`
	Sha512   string                              `json:"sha512"`
	Sha1     string                              `json:"sha1"`
	Md5      string                              `json:"md5"`
	Addition []*PreInstallHookResultAdditionItem `json:"addition"`
}

func (*PreInstallHookResult) Info

func (i *PreInstallHookResult) Info() (*Info, error)

type PreInstallHookResultAdditionItem

type PreInstallHookResultAdditionItem struct {
	Name    string            `json:"name"`
	Url     string            `json:"url"`
	Headers map[string]string `json:"headers"`
	Note    string            `json:"note"`
	Sha256  string            `json:"sha256"`
	Sha512  string            `json:"sha512"`
	Sha1    string            `json:"sha1"`
	Md5     string            `json:"md5"`
}

func (*PreInstallHookResultAdditionItem) Info

type PreUninstallHookCtx

type PreUninstallHookCtx struct {
	Main    *Info            `json:"main"`
	SdkInfo map[string]*Info `json:"sdkInfo"`
}

type PreUseHookCtx

type PreUseHookCtx struct {
	Cwd             string           `json:"cwd"`
	Scope           string           `json:"scope"`
	Version         string           `json:"version"`
	PreviousVersion string           `json:"previousVersion"`
	InstalledSdks   map[string]*Info `json:"installedSdks"`
}

type PreUseHookResult

type PreUseHookResult struct {
	Version Version `json:"version"`
}

type RuntimeInfo

type RuntimeInfo struct {
	OsType        string `json:"osType"`
	ArchType      string `json:"archType"`
	Version       string `json:"version"`
	PluginDirPath string `json:"pluginDirPath"`
}

RuntimeInfo represents the runtime information of the current exec environment.

type UseScope

type UseScope int
const (
	Global UseScope = iota
	Project
	Session
)

func (UseScope) String

func (s UseScope) String() string

type Version

type Version string

Jump to

Keyboard shortcuts

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