Documentation
¶
Index ¶
- Constants
- Variables
- func RunPluginHook(ctx context.Context, directory, hook string, input []byte, ...) (any, error)
- func TestPlugin(ctx context.Context, directory string, options PluginTestOptions) error
- type Arg
- type Manager
- func (m *Manager) Add(pluginName, url, alias string) error
- func (m *Manager) AliasesFor(sdkName string) map[string]string
- func (m *Manager) Available() (RegistryIndex, error)
- func (m *Manager) CleanTmp()
- func (m *Manager) Close()
- func (m *Manager) Diagnose(name string, version sdk.Version, inEffect VersionInEffect) ([]sdk.Finding, error)
- func (m *Manager) GetRegistryAddress(uri string) string
- func (m *Manager) LoadAllSdk() ([]sdk.Sdk, error)
- func (m *Manager) LookupSdk(name string) (sdk.Sdk, error)
- func (m *Manager) LookupSdkWithInstall(name string, autoConfirm bool) (sdk.Sdk, error)
- func (m *Manager) ParseLegacyFile(dirPath string, output func(sdkname, version string)) error
- func (m *Manager) Remove(pluginName string) error
- func (m *Manager) RemoveAliasesFor(sdkName string, version sdk.Version) ([]string, error)
- func (m *Manager) ResolveAlias(sdkName string, s sdk.Sdk, version sdk.Version) sdk.Version
- func (m *Manager) ResolveVersion(sdkName string, version sdk.Version) sdk.Version
- func (m *Manager) ResolveVersionName(sdkName string, s sdk.Sdk, typed sdk.Version) sdk.Version
- func (m *Manager) SetAlias(sdkName, alias string, version sdk.Version) error
- func (m *Manager) UnsetAlias(sdkName, alias string) error
- func (m *Manager) Update(pluginName string) error
- type NotFoundError
- type PluginRunOptions
- type PluginTestOptions
- type RegistryIndex
- type RegistryIndexItem
- type RegistryPluginManifest
- type VersionInEffect
Constants ¶
const RuntimeVersion = "1.1.0"
Variables ¶
var (
ManifestNotFound = errors.New("manifest not found")
)
Functions ¶
func RunPluginHook ¶ added in v1.0.13
func RunPluginHook(ctx context.Context, directory, hook string, input []byte, options PluginRunOptions) (any, error)
RunPluginHook deliberately bypasses NewSdkManager and all user/project state.
func TestPlugin ¶ added in v1.0.13
func TestPlugin(ctx context.Context, directory string, options PluginTestOptions) error
TestPlugin discovers files and reports each result immediately. Each file gets a fresh VM and deadline, including when a previous file failed or timed out.
Types ¶
type Manager ¶
type Manager struct {
RuntimeEnvContext *env.RuntimeEnvContext // runtime environment context
// contains filtered or unexported fields
}
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) AliasesFor ¶ added in v1.1.0
AliasesFor returns the aliases of an SDK as alias -> version.
func (*Manager) Available ¶
func (m *Manager) Available() (RegistryIndex, error)
func (*Manager) Diagnose ¶ added in v1.1.0
func (m *Manager) Diagnose(name string, version sdk.Version, inEffect VersionInEffect) ([]sdk.Finding, error)
Diagnose runs the checks of `vfox doctor`. name and version narrow them down to one SDK, or to one version of it; both empty checks everything. The PATH is only looked at for the version in effect, which inEffect names; without it that is the version Sdk.Current reports, which does not know about the fallback to an installed version that `vfox env` makes. It only reads, so it is safe to run at any time.
func (*Manager) GetRegistryAddress ¶ added in v0.3.0
func (*Manager) LookupSdk ¶
LookupSdk lookup sdk by name Loads SDK plugins and generates env keys based on the tool versions in the chain
func (*Manager) LookupSdkWithInstall ¶ added in v0.3.2
func (*Manager) ParseLegacyFile ¶ added in v0.4.0
ParseLegacyFile parse legacy file and output the sdkname and version
func (*Manager) RemoveAliasesFor ¶ added in v1.1.0
RemoveAliasesFor drops the user's aliases that name a version, which is about to go away. It returns the aliases it removed.
func (*Manager) ResolveAlias ¶ added in v1.1.0
ResolveAlias turns an alias into the version it names. A version that is installed under that very name always wins, and anything that is not an alias is returned unchanged, so it is safe to call on any input.
func (*Manager) ResolveVersion ¶ added in v0.7.0
func (*Manager) ResolveVersionName ¶ added in v1.1.0
ResolveVersionName turns the version a user typed into the version to act on. The name as typed comes first: an installed version of that name, or an alias for one. Only when there is neither is a leading "v" read as the usual way to spell a version (v20.1.0), and the name without it gets the same two checks. What matches neither way is returned without the "v" and left to the caller, which prefix-matches or reports that it is not installed.
func (*Manager) SetAlias ¶ added in v1.1.0
SetAlias names an installed version. The alias is stored in the user config.
func (*Manager) UnsetAlias ¶ added in v1.1.0
UnsetAlias removes an alias from the user config.
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 PluginRunOptions ¶ added in v1.0.13
type PluginTestOptions ¶ added in v1.0.13
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