Documentation
¶
Index ¶
- Variables
- func AddToolToVersions(filePath, tool, version string) error
- func AddToolToVersionsAsDefault(filePath, tool, version string) error
- func AddToolVersion(tool, version string) error
- func AddVersionToTool(toolVersions *ToolVersions, tool, version string, asDefault bool)
- func CleanToolsAndCaches(toolsDir, cacheDir, tempCacheDir string) error
- func DuExec() error
- func EmitEnv(format string, relativeFlag bool) error
- func EmitPath(exportFlag, jsonFlag, relativeFlag bool) error
- func GetAllVersions(toolVersions *ToolVersions, tool string) []string
- func GetAtmosConfig() *schema.AtmosConfiguration
- func GetDefaultVersion(toolVersions *ToolVersions, tool string) (string, bool)
- func GetInstallPath() string
- func GetToolVersionsFilePath() string
- func InfoExec(toolName, outputFormat string) error
- func InstallSingleTool(owner, repo, version string, isLatest bool, showProgressBar bool) error
- func ListToolVersions(showAll bool, limit int, toolName string) error
- func LookupToolVersion(tool string, toolVersions *ToolVersions, resolver ToolResolver) (resolvedKey, version string, found bool)
- func NewAquaRegistry() registry.ToolRegistry
- func NewRegistry(atmosConfig *schema.AtmosConfiguration) (registry.ToolRegistry, error)
- func ParseToolVersionArg(arg string) (string, string, error)
- func RemoveToolFromVersions(filePath, tool, version string) error
- func RemoveToolVersion(filePath, tool, version string) error
- func ResetGitHubAPI()
- func RunExecCommand(installer ToolRunner, args []string) error
- func RunInstall(toolSpec string, setAsDefault, reinstallFlag bool) error
- func RunList() error
- func RunListAtmosVersions() ([]string, error)
- func RunListInstalledAtmosVersions(currentVersion string) error
- func RunUninstall(toolSpec string) error
- func SaveToolVersions(filePath string, toolVersions *ToolVersions) error
- func SetAtmosConfig(config *schema.AtmosConfiguration)
- func SetGitHubAPI(api GitHubAPI)
- func SetToolVersion(toolName, version string, scrollSpeed int) error
- func WhichExec(toolName string) error
- type AquaRegistry
- type DefaultToolResolver
- type File
- type GitHubAPI
- type GitHubAPIClient
- type Installer
- type ModelI
- type Option
- type Override
- type RegistryFactory
- type Tool
- type ToolPath
- type ToolResolver
- type ToolRunner
- type ToolVersionLookupResult
- type ToolVersions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrToolNotFound indicates a tool was not found in the registry or local configuration. ErrToolNotFound = registry.ErrToolNotFound // ErrNoVersionsFound indicates no versions are available for a tool. ErrNoVersionsFound = registry.ErrNoVersionsFound // ErrInvalidToolSpec indicates the tool specification format is invalid. ErrInvalidToolSpec = registry.ErrInvalidToolSpec // ErrHTTPRequest indicates an HTTP request failed. ErrHTTPRequest = registry.ErrHTTPRequest // ErrHTTP404 indicates an HTTP 404 Not Found response. ErrHTTP404 = registry.ErrHTTP404 // ErrRegistryParse indicates the registry file could not be parsed. ErrRegistryParse = registry.ErrRegistryParse // ErrNoPackagesInRegistry indicates the registry contains no packages. ErrNoPackagesInRegistry = registry.ErrNoPackagesInRegistry // ErrNoAssetTemplate indicates no asset template is defined for the tool. ErrNoAssetTemplate = registry.ErrNoAssetTemplate // ErrFileOperation indicates a file operation failed. ErrFileOperation = registry.ErrFileOperation // ErrToolAlreadyExists indicates the tool version already exists in .tool-versions. ErrToolAlreadyExists = registry.ErrToolAlreadyExists )
Error re-exports from the registry package for backward compatibility. New code should import and use toolchain/registry errors directly.
var ( DefaultToolVersionsFilePath = ".tool-versions" DefaultInstallPath = ".tools" )
var BuiltinAliases = installer.BuiltinAliases
BuiltinAliases are always available and can be overridden in atmos.yaml.
Functions ¶
func AddToolToVersions ¶
AddToolToVersions adds a tool/version combination to the .tool-versions file If the tool already exists, it updates the version If the aliased version already exists, it skips adding the non-aliased version to prevent duplicates.
func AddToolToVersionsAsDefault ¶
AddToolToVersionsAsDefault adds a tool and version to the .tool-versions file as the default If the tool already exists, it updates the version and sets it as default.
func AddToolVersion ¶
AddToolVersion contains the actual business logic for adding/updating a tool.
func AddVersionToTool ¶
func AddVersionToTool(toolVersions *ToolVersions, tool, version string, asDefault bool)
AddVersionToTool adds a version to a tool, optionally as default (front of list).
func CleanToolsAndCaches ¶
CleanToolsAndCaches handles the business logic for cleaning tools and cache directories. It performs file counting, deletion, and writes UI messages to stderr.
func DuExec ¶
func DuExec() error
DuExec calculates and displays the total disk space used by installed tools.
func EmitEnv ¶
EmitEnv outputs the PATH entries for installed toolchain binaries in shell-specific format. The format parameter specifies the output format (bash, fish, powershell, json, dotenv), and relativeFlag uses relative paths instead of absolute.
func EmitPath ¶
EmitPath outputs the PATH entries for installed toolchain binaries. The exportFlag outputs in shell export format, jsonFlag outputs JSON, and relativeFlag uses relative paths instead of absolute.
func GetAllVersions ¶
func GetAllVersions(toolVersions *ToolVersions, tool string) []string
GetAllVersions returns all versions for a tool.
func GetAtmosConfig ¶
func GetAtmosConfig() *schema.AtmosConfiguration
GetAtmosConfig returns the current Atmos configuration. Returns nil if not yet initialized.
func GetDefaultVersion ¶
func GetDefaultVersion(toolVersions *ToolVersions, tool string) (string, bool)
GetDefaultVersion returns the default (first) version for a tool.
func GetInstallPath ¶
func GetInstallPath() string
GetInstallPath returns the path where tools are installed. By default, it uses XDG Data directory (~/.local/share/atmos/toolchain on Linux/macOS). Falls back to .tools if XDG directory cannot be created.
func GetToolVersionsFilePath ¶
func GetToolVersionsFilePath() string
GetToolVersionsFilePath returns the path to the tool-versions file.
func InstallSingleTool ¶
func ListToolVersions ¶
ListToolVersions handles the logic for listing tool versions.
func LookupToolVersion ¶
func LookupToolVersion(tool string, toolVersions *ToolVersions, resolver ToolResolver) (resolvedKey, version string, found bool)
LookupToolVersion attempts to find the version for a tool, trying both the raw name and its resolved alias. Returns the key found (raw or alias), the version, and whether it was found.
func NewAquaRegistry ¶
func NewAquaRegistry() registry.ToolRegistry
NewAquaRegistry creates a new Aqua registry client. This is a convenience wrapper that returns the default Aqua implementation.
func NewRegistry ¶
func NewRegistry(atmosConfig *schema.AtmosConfiguration) (registry.ToolRegistry, error)
NewRegistry creates a ToolRegistry from the given Atmos configuration. If registries are configured, returns a CompositeRegistry. Otherwise, returns the default Aqua registry for backward compatibility.
func ParseToolVersionArg ¶
ParseToolVersionArg parses a CLI argument in the form tool, tool@version, or owner/repo@version. Returns tool (or owner/repo), version (may be empty), and error if invalid.
func RemoveToolFromVersions ¶
RemoveToolFromVersions removes a tool from the .tool-versions file.
func RemoveToolVersion ¶
RemoveToolVersion removes either the entire tool or a specific version from the file. If version is empty, removes all versions of the tool.
func ResetGitHubAPI ¶
func ResetGitHubAPI()
ResetGitHubAPI resets the global GitHub API client to the default.
func RunExecCommand ¶
func RunExecCommand(installer ToolRunner, args []string) error
RunExecCommand contains business logic for executing tools. It does not depend on cobra.Command, only raw args.
func RunInstall ¶
RunInstall installs the specified tool (owner/repo@version or alias@version). If toolSpec is empty, installs all tools from .tool-versions file. The setAsDefault parameter controls whether to set the installed version as default. The reinstallFlag parameter forces reinstallation even if already installed.
func RunList ¶
func RunList() error
RunList prints a table of tools from .tool-versions, marking installed/default versions.
func RunListAtmosVersions ¶
RunListAtmosVersions lists all installed versions of Atmos (returns version strings).
func RunListInstalledAtmosVersions ¶
RunListInstalledAtmosVersions prints a formatted table of installed Atmos versions.
func RunUninstall ¶
RunUninstall removes tools by spec (owner/repo, tool, or ).
func SaveToolVersions ¶
func SaveToolVersions(filePath string, toolVersions *ToolVersions) error
SaveToolVersions saves a ToolVersions struct to a .tool-versions file (asdf-compatible).
func SetAtmosConfig ¶
func SetAtmosConfig(config *schema.AtmosConfiguration)
SetAtmosConfig injects the current Atmos configuration into the toolchain package.
func SetGitHubAPI ¶
func SetGitHubAPI(api GitHubAPI)
SetGitHubAPI sets the global GitHub API client (for testing).
func SetToolVersion ¶
SetToolVersion handles the core logic of setting a tool version. If version is empty, it will prompt the user interactively (for GitHub release type tools).
Types ¶
type AquaRegistry ¶
type AquaRegistry = aqua.AquaRegistry
AquaRegistry is a type alias for backward compatibility. New code should use toolchain/registry.ToolRegistry interface.
type DefaultToolResolver ¶
type DefaultToolResolver = installer.DefaultToolResolver
DefaultToolResolver is a type alias for installer.DefaultToolResolver for backward compatibility.
type GitHubAPIClient ¶
type GitHubAPIClient struct{}
GitHubAPIClient implements GitHubAPI using pkg/github.
func NewGitHubAPIClient ¶
func NewGitHubAPIClient() *GitHubAPIClient
NewGitHubAPIClient creates a new GitHub API client.
func (*GitHubAPIClient) FetchReleases ¶
func (g *GitHubAPIClient) FetchReleases(owner, repo string, limit int) ([]string, error)
FetchReleases fetches all available versions from GitHub API.
type Installer ¶
Installer is a type alias for installer.Installer for backward compatibility. New code should import and use toolchain/installer.Installer directly.
func NewInstaller ¶
NewInstaller creates a new Installer with the given options. This is a wrapper around installer.New() for backward compatibility. It automatically injects the real registry factory and loads registries. Configuration is read from atmos.yaml.
func NewInstallerWithBinDir ¶ added in v1.204.0
NewInstallerWithBinDir creates an installer with a specific bin directory. This is a convenience wrapper for testing.
func NewInstallerWithResolver ¶
func NewInstallerWithResolver(resolver ToolResolver, binDir string) *Installer
NewInstallerWithResolver creates an installer with a custom resolver. Deprecated: Use NewInstaller() with WithResolver() option instead.
type Option ¶ added in v1.204.0
Option is a type alias for installer.Option for backward compatibility.
func WithBinDir ¶ added in v1.204.0
WithBinDir sets the binary installation directory.
func WithCacheDir ¶ added in v1.204.0
WithCacheDir sets the cache directory.
func WithConfiguredRegistry ¶ added in v1.204.0
func WithConfiguredRegistry(reg registry.ToolRegistry) Option
WithConfiguredRegistry sets a pre-configured registry.
func WithRegistryFactory ¶ added in v1.204.0
func WithRegistryFactory(factory RegistryFactory) Option
WithRegistryFactory sets the factory for creating registry instances.
func WithResolver ¶ added in v1.204.0
func WithResolver(resolver ToolResolver) Option
WithResolver sets the tool resolver.
type RegistryFactory ¶ added in v1.204.0
type RegistryFactory = installer.RegistryFactory
RegistryFactory is a type alias for installer.RegistryFactory for backward compatibility.
type Tool ¶
Tool is a type alias for registry.Tool for backward compatibility. New code should import and use toolchain/registry.Tool directly.
type ToolPath ¶
type ToolPath struct {
Tool string `json:"tool"`
Version string `json:"version"`
Path string `json:"path"`
}
ToolPath represents a tool with its version and path.
type ToolResolver ¶
type ToolResolver = installer.ToolResolver
ToolResolver is a type alias for installer.ToolResolver for backward compatibility.
type ToolRunner ¶
type ToolRunner interface {
FindBinaryPath(owner, repo, version string, binaryName ...string) (string, error)
GetResolver() ToolResolver
CreateLatestFile(owner, repo, version string) error
ReadLatestFile(owner, repo string) (string, error)
}
ToolRunner defines the interface for running and resolving tools (for real and mock installers).
type ToolVersionLookupResult ¶
type ToolVersionLookupResult struct {
ResolvedKey string // The key found (raw tool name or owner/repo alias).
Version string // The version string.
Found bool // Whether the tool was found in toolVersions.
UsedLatest bool // Whether 'latest' was used as a fallback.
}
ToolVersionLookupResult holds the result of looking up a tool version.
func LookupToolVersionOrLatest ¶
func LookupToolVersionOrLatest(tool string, toolVersions *ToolVersions, resolver ToolResolver) ToolVersionLookupResult
LookupToolVersionOrLatest attempts to find the version for a tool, trying both the raw name and its resolved alias. If not found, but the alias resolves, returns 'latest' as the version and usedLatest=true.
type ToolVersions ¶
ToolVersions represents the .tool-versions file format (asdf-compatible: tool -> list of versions, first is default).
func LoadToolVersions ¶
func LoadToolVersions(filePath string) (*ToolVersions, error)
LoadToolVersions loads a .tool-versions file (asdf-compatible: tool version1 [version2 ...]).
Source Files
¶
- add.go
- aqua_registry.go
- atmos_registry.go
- clean.go
- du.go
- env.go
- errors.go
- exec.go
- get.go
- github.go
- info.go
- info_helpers.go
- info_table_helpers.go
- install.go
- install_helpers.go
- install_validation_helpers.go
- list.go
- list_helpers.go
- list_table.go
- path.go
- path_helpers.go
- progress.go
- remove.go
- remove_helpers.go
- set.go
- set_helpers.go
- setup.go
- testing.go
- tool_versions.go
- types.go
- uninstall.go
- which.go