Documentation
¶
Index ¶
Constants ¶
View Source
const (
ContextLogWriterKey ctxKey = "context.log.writer"
)
Variables ¶
View Source
var GetLanguage = func(name string) (Language, bool) {
lang, exists := languages[name]
return lang, exists
}
View Source
var GetRootDir = func() string { if custom := os.Getenv("GVM_ROOT"); custom != "" { if !strings.Contains(custom, " ") { ensureDir(custom) return custom } } if cfgDir, err := os.UserConfigDir(); err == nil && cfgDir != "" { path := filepath.Join(cfgDir, defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } home := os.Getenv("HOME") if home != "" { path := filepath.Join(home, defaultDir) if !strings.Contains(path, " ") { ensureDir(path) return path } } fallback := filepath.Join("/opt", "gvm") ensureDir(fallback) return fallback }
View Source
var Version = "1.0.0-dev"
Functions ¶
func GetAllLanguage ¶
func GetAllLanguage() []string
func GetConfigPath ¶ added in v0.0.4
func GetConfigPath() string
func RegisterLanguage ¶
func RegisterLanguage(lang Language)
Types ¶
type Config ¶ added in v0.0.4
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 ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.