Documentation
¶
Index ¶
Constants ¶
View Source
const (
ContextLogWriterKey ctxKey = "context.log.writer"
)
Variables ¶
View Source
var GetLanguage = func(name string) (Language, bool) {
langRWMutex.RLock()
lang, exists := languages[name]
langRWMutex.RUnlock()
return lang, exists
}
View Source
var GetRootDir = func() string { if custom := os.Getenv("XVM_ROOT"); custom != "" { if !strings.Contains(custom, " ") { ensureDir(custom) return custom } } if dataHome := os.Getenv("XDG_DATA_HOME"); dataHome != "" { path := filepath.Join(dataHome, defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } if homeDir, err := os.UserHomeDir(); err == nil && homeDir != "" { path := filepath.Join(homeDir, ".local", "share", defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } if cfgDir, err := os.UserConfigDir(); err == nil && cfgDir != "" { path := filepath.Join(cfgDir, defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } if home := os.Getenv("HOME"); home != "" { path := filepath.Join(home, defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } fallback := filepath.Join("/opt", "xvm") ensureDir(fallback) return fallback }
View Source
var Version = "1.0.0-dev"
Functions ¶
Types ¶
type Config ¶
type Config struct {
Language string `json:"language"`
Addon []LanguageItem `json:"addon"`
}
type InstalledVersion ¶
type Language ¶
type Language interface {
Name() string
ListRemoteVersions(ctx context.Context) ([]*RemoteVersion, error)
ListInstalledVersions(ctx context.Context) ([]*InstalledVersion, error)
SetDefaultVersion(ctx context.Context, version string) error
GetDefaultVersion(ctx context.Context) *InstalledVersion
Install(ctx context.Context, remoteVersion *RemoteVersion) error
Uninstall(ctx context.Context, version string) error
}
type LanguageItem ¶
Source Files
¶
- config.go
- interface.go
- registry.go
Click to show internal directories.
Click to hide internal directories.