Documentation
¶
Index ¶
- Variables
- func DefaultDownload(url string) ([]byte, error)
- func RunWithSpinner(name, version string, fn func() error) error
- func ShowChecklist(tools []Tool) []int
- type Deps
- type InstallResult
- type Installer
- func (ins *Installer) InstallAll(tools []Tool, selectedIdx []int, deps *Deps) InstallResult
- func (ins *Installer) InstallBinary(t Tool, d *Deps) error
- func (i *Installer) InstallGoInstall(t Tool, d *Deps) error
- func (ins *Installer) Uninstall(tools []Tool, d *Deps) error
- func (i *Installer) Verify(t Tool, d *Deps) error
- type Mode
- type Tool
Constants ¶
This section is empty.
Variables ¶
var GoVersion string
var Tools = []Tool{ {Mode: GoInstall, Name: "tinygoinstall", Source: "github.com/tinywasm/tinygo/cmd/tinygoinstall", Version: "0.40.1", Required: true}, {Mode: Binary, Name: "tinywasm-cli", Source: "https://github.com/tinywasm/tinywasm", Version: "0.1.0", Required: false}, {Mode: Binary, Name: "tinywasm-server", Source: "https://github.com/tinywasm/tinywasm", Version: "0.1.0", Required: false, DependsOn: "tinywasm-cli"}, }
Functions ¶
func DefaultDownload ¶
DefaultDownload is a production implementation of Download
func RunWithSpinner ¶
RunWithSpinner runs the given function while displaying a spinner. version is shown in the success line: "✅ name — version"
func ShowChecklist ¶
ShowChecklist displays optional tools and returns the selected indices. Uses raw terminal mode to capture ↑/↓/Space/Enter without buffering.
Types ¶
type Deps ¶
type Deps struct {
RunCmd func(name string, args ...string) ([]byte, error) // exec.Command
Download func(url string) ([]byte, error) // net/http GET
WriteFile func(path string, data []byte, perm os.FileMode) error // os.WriteFile
RemoveFile func(path string) error // os.Remove
LookPath func(name string) (string, error) // exec.LookPath
Checklist func(tools []Tool) []int // interactive checklist
}
Deps — all external operations behind interfaces for testability
type InstallResult ¶
InstallResult holds counts for the summary line.
type Installer ¶
type Installer struct{}
func (*Installer) InstallAll ¶
func (ins *Installer) InstallAll(tools []Tool, selectedIdx []int, deps *Deps) InstallResult
InstallAll installs required tools + the optional tools at the given indices. Returns counts for summary output. On required tool failure, writes to stderr and exits.
func (*Installer) InstallBinary ¶
InstallBinary handles the installation of tools from GitHub releases.
func (*Installer) InstallGoInstall ¶
InstallGoInstall handles the installation of tools using `go install source@version`.