installer

package
v1.231.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package installer identifies the installation managing the running Atmos binary. Detection is advisory and never installs software or refreshes package indexes.

Index

Constants

View Source
const (
	// InstallURL is the fallback for unrecognized or manually installed binaries.
	InstallURL = "https://atmos.tools/install"
	// ReleasesURL also offers native packages that do not require a repository.
	ReleasesURL = "https://github.com/cloudposse/atmos/releases"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hint

type Hint struct {
	Condition string
	Command   string
	Message   string
	URL       string
}

Hint contains presentation-independent upgrade guidance. Condition must be displayed before Command; it is never an unconditional action.

type Installation

type Installation struct {
	Kind        Kind
	Executable  string
	PackageName string
	// Manager is the available upgrade command, empty when it cannot be found.
	Manager string
	Global  bool
	// contains filtered or unexported fields
}

Installation describes ownership of the running executable.

func Detect

func Detect(ctx context.Context, opts ...Option) Installation

Detect identifies the running installation using local evidence and bounded probes.

func (Installation) UpgradeHint

func (i Installation) UpgradeHint(latestVersion string) Hint

UpgradeHint recommends an action without assuming package repository availability.

type Kind

type Kind string

Kind identifies installation ownership, not the repository a package came from.

const (
	Unknown  Kind = "unknown"
	Homebrew Kind = "homebrew"
	DEB      Kind = "deb"
	RPM      Kind = "rpm"
	APK      Kind = "apk"
	Scoop    Kind = "scoop"
	Mise     Kind = "mise"
	ASDF     Kind = "asdf"
	Aqua     Kind = "aqua"
	Nix      Kind = "nix"
	Go       Kind = "go"
	Native   Kind = "atmos"
)

Supported installation kinds.

type Option

type Option func(*options)

Option configures detection dependencies or installation roots.

func WithNativeRoots

func WithNativeRoots(roots ...string) Option

WithNativeRoots supplies Atmos toolchain installation roots (above bin/).

func WithSystem

func WithSystem(system System) Option

WithSystem replaces operating system operations, primarily for testing.

type System

type System interface {
	GOOS() string
	Getenv(string) string
	Executable() (string, error)
	EvalSymlinks(string) (string, error)
	Abs(string) (string, error)
	UserHomeDir() (string, error)
	LookPath(string) (string, error)
	Output(context.Context, string, ...string) ([]byte, error)
	BuildInfo() (*debug.BuildInfo, bool)
}

System supplies read-only operating system operations for installation detection. Output implementations must honor context cancellation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL