Documentation
¶
Index ¶
- func DownloadTool(tool ToolDef, platform Platform, destDir string, progress func(pct float64)) error
- func DownloadToolWithContext(ctx context.Context, tool ToolDef, platform Platform, destDir string, ...) error
- func IsToolInstalled(destDir, toolName string) bool
- func SyncAll(tools []ToolDef, platform Platform, destDir string, ...) error
- func SyncAllWithContext(ctx context.Context, tools []ToolDef, platform Platform, destDir string, ...) error
- func ToolBinPath(destDir, toolName string) string
- type Platform
- type ToolDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadTool ¶
func DownloadTool(tool ToolDef, platform Platform, destDir string, progress func(pct float64)) error
DownloadTool downloads a tool binary from the registry.
func DownloadToolWithContext ¶
func DownloadToolWithContext(ctx context.Context, tool ToolDef, platform Platform, destDir string, progress func(pct float64)) error
DownloadToolWithContext downloads a tool binary from the registry with context support.
func IsToolInstalled ¶
IsToolInstalled checks if a tool binary exists at the expected path.
func SyncAll ¶
func SyncAll(tools []ToolDef, platform Platform, destDir string, onProgress func(tool string, pct float64)) error
SyncAll downloads all tools, skipping those already installed unless forced.
func SyncAllWithContext ¶
func SyncAllWithContext(ctx context.Context, tools []ToolDef, platform Platform, destDir string, onProgress func(tool string, pct float64)) error
SyncAllWithContext downloads all tools with context support, skipping those already installed unless forced.
func ToolBinPath ¶
ToolBinPath returns the expected path to a tool binary.
Types ¶
type Platform ¶
Platform represents the target OS and architecture for tool downloads.
func DetectPlatform ¶
func DetectPlatform() Platform
DetectPlatform returns the current runtime platform.
type ToolDef ¶
type ToolDef struct {
Name string // Tool name (e.g., "templ")
Version string // Pinned version
URLTemplate string // URL template with {{.OS}}, {{.Arch}}, {{.Version}} placeholders
BinaryName string // Expected binary filename after extraction
IsArchive bool // true if download is tar.gz/zip that needs extraction
Checksums map[string]string // platform string -> SHA256 hex (e.g., "darwin_arm64" -> "abc123...")
OSMap map[string]string // optional: runtime OS -> tool OS name (e.g., "darwin" -> "macos")
ArchMap map[string]string // optional: runtime Arch -> tool arch name (e.g., "amd64" -> "x64")
}
ToolDef defines a downloadable tool with version, URL pattern, and checksums.
func DefaultRegistry ¶
func DefaultRegistry() []ToolDef
DefaultRegistry returns the tool definitions for all supported tools.