Documentation
¶
Index ¶
- Constants
- Variables
- type Arg
- type LocationPackage
- type Manager
- func (m *Manager) Add(pluginName, url, alias string) error
- func (m *Manager) Available() (RegistryIndex, error)
- func (m *Manager) CleanTmp()
- func (m *Manager) Close()
- func (m *Manager) EnvKeys(tvs toolset.MultiToolVersions, location base.Location) (SdkEnvs, error)
- func (m *Manager) GetRegistryAddress(uri string) string
- func (m *Manager) GlobalEnvKeys() (SdkEnvs, error)
- func (m *Manager) HttpClient() *http.Client
- func (m *Manager) LoadAllSdk() ([]*Sdk, error)
- func (m *Manager) LookupSdk(name string) (*Sdk, error)
- func (m *Manager) LookupSdkWithInstall(name string, autoConfirm bool) (*Sdk, error)
- func (m *Manager) Remove(pluginName string) error
- func (m *Manager) ResolveVersion(sdkName string, version base.Version) base.Version
- func (m *Manager) SessionEnvKeys(opt SessionEnvOptions) (SdkEnvs, error)
- func (m *Manager) Update(pluginName string) error
- func (m *Manager) WorkspaceToolVersion() (*toolset.ToolVersion, error)
- type NotFoundError
- type PathMeta
- type RegistryIndex
- type RegistryIndexItem
- type RegistryPluginManifest
- type Sdk
- func (b *Sdk) Available(args []string) ([]*base.Package, error)
- func (b *Sdk) CheckExists(version base.Version) bool
- func (b *Sdk) ClearCurrentEnv() error
- func (b *Sdk) Close()
- func (b *Sdk) Current() base.Version
- func (b *Sdk) Download(u *url.URL, headers map[string]string) (string, error)
- func (b *Sdk) EnvKeys(version base.Version, location base.Location) (*env.Envs, error)
- func (b *Sdk) GetLinkPackage(version base.Version, location base.Location) (*LocationPackage, error)
- func (b *Sdk) GetLocalSdkPackage(version base.Version) (*base.Package, error)
- func (b *Sdk) Install(version base.Version) error
- func (b *Sdk) Label(version base.Version) string
- func (b *Sdk) List() []base.Version
- func (b *Sdk) MockEnvKeys(version base.Version, location base.Location) (*env.Envs, error)
- func (b *Sdk) ParseLegacyFile(path string) (base.Version, error)
- func (b *Sdk) PreUse(version base.Version, scope base.UseScope) (base.Version, error)
- func (b *Sdk) ToLinkPackage(version base.Version, location base.Location) error
- func (b *Sdk) Uninstall(version base.Version) (err error)
- func (b *Sdk) Unuse(scope base.UseScope) error
- func (b *Sdk) Use(version base.Version, scope base.UseScope) error
- func (b *Sdk) VersionPath(version base.Version) string
- type SdkEnv
- type SdkEnvs
- type SessionEnvOptions
- type VersionNotExistsError
Constants ¶
const ( HookCurTmpPath = "__VFOX_CURTMPPATH" HOME_DIR = ".version-fox" PLUGIN_DIR = "plugin" CACHE_DIR = "cache" TEMP_DIR = "temp" )
const RuntimeVersion = "0.9.2"
Variables ¶
var (
ManifestNotFound = errors.New("manifest not found")
)
Functions ¶
This section is empty.
Types ¶
type LocationPackage ¶ added in v0.5.3
type LocationPackage struct {
// contains filtered or unexported fields
}
LocationPackage represents a package that needs to be linked
func (*LocationPackage) ConvertLocation ¶ added in v0.5.3
func (l *LocationPackage) ConvertLocation() *base.Package
type Manager ¶
type Manager struct {
PathMeta *PathMeta
EnvManager env.Manager
Config *config.Config
// contains filtered or unexported fields
}
func NewSdkManager ¶
func NewSdkManager() *Manager
func (*Manager) Add ¶
Add a plugin to plugin home directory 1. If the plugin is an official plugin, fetch the plugin manifest from the registry. 2. If the plugin is a custom plugin, install the plugin from the specified URL. 3. Validate the plugin and install it to the plugin home directory. examples:
vfox add nodejs vfox add --alias node nodejs vfox add --source /path/to/plugin.zip vfox add --source /path/to/plugin.zip --alias node [nodejs]
func (*Manager) Available ¶
func (m *Manager) Available() (RegistryIndex, error)
func (*Manager) GetRegistryAddress ¶ added in v0.3.0
func (*Manager) GlobalEnvKeys ¶ added in v0.6.2
func (*Manager) HttpClient ¶ added in v0.3.2
func (*Manager) LoadAllSdk ¶
func (*Manager) LookupSdkWithInstall ¶ added in v0.3.2
func (*Manager) ResolveVersion ¶ added in v0.7.0
func (*Manager) SessionEnvKeys ¶ added in v0.6.2
func (m *Manager) SessionEnvKeys(opt SessionEnvOptions) (SdkEnvs, error)
SessionEnvKeys returns the environment variables that need to be set and/or unset by the shell. This is determined by the contents of any .tool-versions files in the following locations, in the following order of precedence:
- Current working directory (in this directory, any legacy version files are also considered)
- vfox home directory (only if the WithGlobalEnv option is set to true)
- Current session's vfox temp directory
The function maintains environment state through two mechanisms:
- Updates the .tool-versions file in the current session's temp directory to track active SDK versions
- Uses a "flush_env.cache" file in the current session's temp directory to prevent redundant environment variable updates
Parameters:
- opt: SessionEnvOptions controlling whether global environment variables should be included
Returns:
- SdkEnvs: A slice of SDK environment configurations that need to be applied
- error: Any error encountered during processing
The returned environment configurations remain valid for the entire shell session until one of the following conditions is met:
- A new .tool-versions file is encountered
- The environment is explicitly modified via the `use` command
func (*Manager) WorkspaceToolVersion ¶ added in v0.7.0
func (m *Manager) WorkspaceToolVersion() (*toolset.ToolVersion, error)
type NotFoundError ¶ added in v0.3.2
type NotFoundError struct {
Msg string
}
func (NotFoundError) Error ¶ added in v0.3.2
func (n NotFoundError) Error() string
type RegistryIndex ¶ added in v0.3.0
type RegistryIndex []*RegistryIndexItem
RegistryIndex is the index of the registry
type RegistryIndexItem ¶ added in v0.3.0
type RegistryIndexItem struct {
Name string `json:"name"`
Desc string `json:"desc"`
Homepage string `json:"homepage"`
}
RegistryIndexItem is the item in the registry index
type RegistryPluginManifest ¶ added in v0.3.0
type RegistryPluginManifest struct {
Name string `json:"name"`
Version string `json:"version"`
License string `json:"license"`
Author string `json:"author"`
DownloadUrl string `json:"downloadUrl"`
MinRuntimeVersion string `json:"minRuntimeVersion"`
}
RegistryPluginManifest is the manifest of a remote plugin
type Sdk ¶
type Sdk struct {
Name string
Plugin *plugin.PluginWrapper
// current sdk install path
InstallPath string
// contains filtered or unexported fields
}
func (*Sdk) ClearCurrentEnv ¶ added in v0.5.0
func (*Sdk) Current ¶
Current returns the current version of the SDK. Lookup priority is: project > session > global
func (*Sdk) GetLinkPackage ¶ added in v0.5.3
func (b *Sdk) GetLinkPackage(version base.Version, location base.Location) (*LocationPackage, error)
GetLinkPackage will make symlink according base.Location and return the sdk package.
func (*Sdk) GetLocalSdkPackage ¶ added in v0.4.0
func (*Sdk) MockEnvKeys ¶ added in v0.5.3
MockEnvKeys It just simulates to get the environment configuration information, if the corresponding location of the package does not exist, then it will return the empty environment information, without calling the EnvKeys hook.
func (*Sdk) ParseLegacyFile ¶ added in v0.4.0
func (*Sdk) ToLinkPackage ¶ added in v0.5.3
type SdkEnvs ¶ added in v0.5.0
type SdkEnvs []*SdkEnv
func (*SdkEnvs) ToExportEnvs ¶ added in v0.6.2
type SessionEnvOptions ¶ added in v0.6.2
type SessionEnvOptions struct {
WithGlobalEnv bool
}
type VersionNotExistsError ¶ added in v0.6.7
type VersionNotExistsError struct {
Label string
}
func (*VersionNotExistsError) Error ¶ added in v0.6.7
func (e *VersionNotExistsError) Error() string