manager

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUpgradeNotSupported = errors.New("this package manager does not support upgrading a single package")

ErrUpgradeNotSupported is returned when a manager cannot upgrade a single package.

Functions

func FetchDependencies added in v0.2.0

func FetchDependencies(mgrs []Manager, pkgs []model.Package, cache *DepsCache) map[string][]string

FetchDependencies fetches dependency lists for all packages, using the cache where possible and falling back to the manager's DependencyLister interface.

func FetchDescriptions

func FetchDescriptions(mgrs []Manager, pkgs []model.Package, cache *DescriptionCache) map[string]string

FetchDescriptions fetches descriptions for all packages, using the cache where possible and falling back to the manager's Describer interface.

func FetchUpdates

func FetchUpdates(mgrs []Manager, pkgs []model.Package, cache *UpdateCache) map[string]string

FetchUpdates checks for available updates across all managers, using the cache. Returns a map of package key → latest version.

func FormatBytes

func FormatBytes(b int64) string

FormatBytes returns a human-readable size string.

func LoadScanCache

func LoadScanCache() []model.Package

LoadScanCache returns cached packages if the cache exists and is fresh. Returns nil if stale or missing.

func ParseSizeString

func ParseSizeString(s string) int64

ParseSizeString converts a human-readable size like "1.5 MiB" or "234 KiB" into bytes. Returns 0 if parsing fails.

func QueryDetail

func QueryDetail(name string) (model.Package, error)

QueryDetail fetches extended info for a single pacman package.

func SanitizeDesc added in v0.2.0

func SanitizeDesc(s string) string

SanitizeDesc strips HTML tags and collapses whitespace from descriptions.

func SaveScanCache

func SaveScanCache(pkgs []model.Package)

SaveScanCache writes the package list to the cache file.

func ScanCacheAge

func ScanCacheAge() time.Duration

ScanCacheAge returns how old the cache is, or -1 if no cache.

func SplitApkNameVersion added in v0.2.0

func SplitApkNameVersion(s string) (string, string)

SplitApkNameVersion splits "name-version-rN" by finding the version boundary. Alpine package names can contain hyphens, so we look for the last hyphen that is followed by a digit.

func SplitPkgsrcNameVersion added in v0.2.0

func SplitPkgsrcNameVersion(s string) (string, string)

SplitPkgsrcNameVersion splits "name-version" by the last hyphen.

func SplitXbpsNameVersion added in v0.2.0

func SplitXbpsNameVersion(s string) (string, string)

SplitXbpsNameVersion splits "name-version_revision" by the last hyphen before a digit.

Types

type AUR

type AUR struct{}

func (*AUR) Available

func (a *AUR) Available() bool

func (*AUR) CheckUpdates

func (a *AUR) CheckUpdates(pkgs []model.Package) map[string]string

func (*AUR) Describe

func (a *AUR) Describe(pkgs []model.Package) map[string]string

func (*AUR) ListDependencies added in v0.2.0

func (a *AUR) ListDependencies(pkgs []model.Package) map[string][]string

func (*AUR) Name

func (a *AUR) Name() model.Source

func (*AUR) Scan

func (a *AUR) Scan() ([]model.Package, error)

type Apk

type Apk struct{}

func (*Apk) Available

func (a *Apk) Available() bool

func (*Apk) CheckUpdates

func (a *Apk) CheckUpdates(pkgs []model.Package) map[string]string

func (*Apk) Describe

func (a *Apk) Describe(pkgs []model.Package) map[string]string

func (*Apk) ListDependencies added in v0.2.0

func (a *Apk) ListDependencies(pkgs []model.Package) map[string][]string

func (*Apk) Name

func (a *Apk) Name() model.Source

func (*Apk) RemoveCmd added in v0.3.0

func (a *Apk) RemoveCmd(name string) *exec.Cmd

func (*Apk) Scan

func (a *Apk) Scan() ([]model.Package, error)

func (*Apk) UpgradeCmd added in v0.2.13

func (a *Apk) UpgradeCmd(name string) *exec.Cmd

type Apt

type Apt struct{}

func (*Apt) Available

func (a *Apt) Available() bool

func (*Apt) CheckUpdates

func (a *Apt) CheckUpdates(pkgs []model.Package) map[string]string

func (*Apt) Describe

func (a *Apt) Describe(pkgs []model.Package) map[string]string

func (*Apt) InstallCmd added in v0.3.0

func (a *Apt) InstallCmd(name string) *exec.Cmd

func (*Apt) ListDependencies added in v0.2.0

func (a *Apt) ListDependencies(pkgs []model.Package) map[string][]string

func (*Apt) Name

func (a *Apt) Name() model.Source

func (*Apt) RemoveCmd added in v0.3.0

func (a *Apt) RemoveCmd(name string) *exec.Cmd

func (*Apt) RemoveCmdWithDeps added in v0.3.0

func (a *Apt) RemoveCmdWithDeps(name string) *exec.Cmd

func (*Apt) Scan

func (a *Apt) Scan() ([]model.Package, error)

func (*Apt) Search added in v0.3.0

func (a *Apt) Search(query string) ([]model.Package, error)

func (*Apt) UpgradeCmd added in v0.2.13

func (a *Apt) UpgradeCmd(name string) *exec.Cmd

type Brew

type Brew struct{}

func (*Brew) Available

func (b *Brew) Available() bool

func (*Brew) CheckUpdates

func (b *Brew) CheckUpdates(pkgs []model.Package) map[string]string

func (*Brew) Describe

func (b *Brew) Describe(pkgs []model.Package) map[string]string

func (*Brew) InstallCmd added in v0.3.0

func (b *Brew) InstallCmd(name string) *exec.Cmd

func (*Brew) ListDependencies added in v0.2.0

func (b *Brew) ListDependencies(pkgs []model.Package) map[string][]string

func (*Brew) Name

func (b *Brew) Name() model.Source

func (*Brew) RemoveCmd added in v0.3.0

func (b *Brew) RemoveCmd(name string) *exec.Cmd

func (*Brew) Scan

func (b *Brew) Scan() ([]model.Package, error)

func (*Brew) Search added in v0.3.0

func (b *Brew) Search(query string) ([]model.Package, error)

func (*Brew) UpgradeCmd added in v0.2.13

func (b *Brew) UpgradeCmd(name string) *exec.Cmd

type Bun

type Bun struct{}

func (*Bun) Available

func (b *Bun) Available() bool

func (*Bun) Name

func (b *Bun) Name() model.Source

func (*Bun) Scan

func (b *Bun) Scan() ([]model.Package, error)

type Cargo

type Cargo struct{}

func (*Cargo) Available

func (c *Cargo) Available() bool

func (*Cargo) Name

func (c *Cargo) Name() model.Source

func (*Cargo) RemoveCmd added in v0.3.0

func (c *Cargo) RemoveCmd(name string) *exec.Cmd

func (*Cargo) Scan

func (c *Cargo) Scan() ([]model.Package, error)

func (*Cargo) UpgradeCmd added in v0.2.13

func (c *Cargo) UpgradeCmd(name string) *exec.Cmd

type Chocolatey added in v0.2.0

type Chocolatey struct{}

Chocolatey manages packages via the Chocolatey package manager for Windows.

func (*Chocolatey) Available added in v0.2.0

func (c *Chocolatey) Available() bool

func (*Chocolatey) CheckUpdates added in v0.2.0

func (c *Chocolatey) CheckUpdates(_ []model.Package) map[string]string

CheckUpdates runs `choco outdated` to find packages with available updates.

func (*Chocolatey) InstallCmd added in v0.3.0

func (c *Chocolatey) InstallCmd(name string) *exec.Cmd

func (*Chocolatey) Name added in v0.2.0

func (c *Chocolatey) Name() model.Source

func (*Chocolatey) RemoveCmd added in v0.3.0

func (c *Chocolatey) RemoveCmd(name string) *exec.Cmd

func (*Chocolatey) Scan added in v0.2.0

func (c *Chocolatey) Scan() ([]model.Package, error)

Scan lists locally installed Chocolatey packages. Handles both Chocolatey v1 (requires --local-only flag) and v2+ (local by default).

func (*Chocolatey) Search added in v0.3.0

func (c *Chocolatey) Search(query string) ([]model.Package, error)

func (*Chocolatey) UpgradeCmd added in v0.2.13

func (c *Chocolatey) UpgradeCmd(name string) *exec.Cmd

type Composer

type Composer struct{}

func (*Composer) Available

func (c *Composer) Available() bool

func (*Composer) CheckUpdates

func (c *Composer) CheckUpdates(pkgs []model.Package) map[string]string

func (*Composer) Describe

func (c *Composer) Describe(pkgs []model.Package) map[string]string

func (*Composer) ListDependencies added in v0.2.0

func (c *Composer) ListDependencies(pkgs []model.Package) map[string][]string

func (*Composer) Name

func (c *Composer) Name() model.Source

func (*Composer) Scan

func (c *Composer) Scan() ([]model.Package, error)

type Conda

type Conda struct{}

func (*Conda) Available

func (c *Conda) Available() bool

func (*Conda) CheckUpdates

func (c *Conda) CheckUpdates(pkgs []model.Package) map[string]string

func (*Conda) ListDependencies added in v0.2.0

func (c *Conda) ListDependencies(pkgs []model.Package) map[string][]string

func (*Conda) Name

func (c *Conda) Name() model.Source

func (*Conda) RemoveCmd added in v0.3.0

func (c *Conda) RemoveCmd(name string) *exec.Cmd

func (*Conda) Scan

func (c *Conda) Scan() ([]model.Package, error)

func (*Conda) UpgradeCmd added in v0.2.13

func (c *Conda) UpgradeCmd(name string) *exec.Cmd

type DeepRemover added in v0.3.0

type DeepRemover interface {
	RemoveCmdWithDeps(name string) *exec.Cmd
}

DeepRemover is implemented by managers that can also remove a package along with its orphaned dependencies.

type DependencyLister added in v0.2.0

type DependencyLister interface {
	ListDependencies(pkgs []model.Package) map[string][]string
}

DependencyLister is implemented by managers that can fetch package dependencies.

type DepsCache added in v0.2.0

type DepsCache struct {
	// contains filtered or unexported fields
}

DepsCache persists dependency lists to disk with a 24h TTL.

func NewDepsCache added in v0.2.0

func NewDepsCache() *DepsCache

func (*DepsCache) Flush added in v0.2.0

func (dc *DepsCache) Flush()

Flush writes the cache to disk.

func (*DepsCache) Get added in v0.2.0

func (dc *DepsCache) Get(key string) ([]string, bool)

Get returns cached dependencies if they exist and haven't expired.

func (*DepsCache) Set added in v0.2.0

func (dc *DepsCache) Set(key string, deps []string)

Set stores a dependency list in the cache.

type Describer

type Describer interface {
	Describe(pkgs []model.Package) map[string]string
}

Describer is implemented by managers that can fetch package descriptions.

type DescriptionCache

type DescriptionCache struct {
	// contains filtered or unexported fields
}

DescriptionCache persists descriptions to disk with a 24h TTL.

func NewDescriptionCache

func NewDescriptionCache() *DescriptionCache

func (*DescriptionCache) Flush

func (dc *DescriptionCache) Flush()

Flush writes the cache to disk.

func (*DescriptionCache) Get

func (dc *DescriptionCache) Get(key string) (string, bool)

Get returns a cached description if it exists and hasn't expired.

func (*DescriptionCache) Set

func (dc *DescriptionCache) Set(key, desc string)

Set stores a description in the cache.

type Dnf

type Dnf struct{}

func (*Dnf) Available

func (d *Dnf) Available() bool

func (*Dnf) CheckUpdates

func (d *Dnf) CheckUpdates(pkgs []model.Package) map[string]string

func (*Dnf) Describe

func (d *Dnf) Describe(pkgs []model.Package) map[string]string

func (*Dnf) InstallCmd added in v0.3.0

func (d *Dnf) InstallCmd(name string) *exec.Cmd

func (*Dnf) ListDependencies added in v0.2.0

func (d *Dnf) ListDependencies(pkgs []model.Package) map[string][]string

func (*Dnf) Name

func (d *Dnf) Name() model.Source

func (*Dnf) RemoveCmd added in v0.3.0

func (d *Dnf) RemoveCmd(name string) *exec.Cmd

func (*Dnf) RemoveCmdWithDeps added in v0.3.0

func (d *Dnf) RemoveCmdWithDeps(name string) *exec.Cmd

func (*Dnf) Scan

func (d *Dnf) Scan() ([]model.Package, error)

func (*Dnf) Search added in v0.3.0

func (d *Dnf) Search(query string) ([]model.Package, error)

func (*Dnf) UpgradeCmd added in v0.2.13

func (d *Dnf) UpgradeCmd(name string) *exec.Cmd

type Flatpak

type Flatpak struct{}

func (*Flatpak) Available

func (f *Flatpak) Available() bool

func (*Flatpak) CheckUpdates

func (f *Flatpak) CheckUpdates(pkgs []model.Package) map[string]string

func (*Flatpak) Describe

func (f *Flatpak) Describe(pkgs []model.Package) map[string]string

func (*Flatpak) InstallCmd added in v0.3.0

func (f *Flatpak) InstallCmd(name string) *exec.Cmd

func (*Flatpak) ListDependencies added in v0.2.0

func (f *Flatpak) ListDependencies(pkgs []model.Package) map[string][]string

func (*Flatpak) Name

func (f *Flatpak) Name() model.Source

func (*Flatpak) RemoveCmd added in v0.3.0

func (f *Flatpak) RemoveCmd(name string) *exec.Cmd

func (*Flatpak) Scan

func (f *Flatpak) Scan() ([]model.Package, error)

func (*Flatpak) Search added in v0.3.0

func (f *Flatpak) Search(query string) ([]model.Package, error)

func (*Flatpak) UpgradeCmd added in v0.2.13

func (f *Flatpak) UpgradeCmd(name string) *exec.Cmd

type FreeBSDPkg

type FreeBSDPkg struct{}

func (*FreeBSDPkg) Available

func (f *FreeBSDPkg) Available() bool

func (*FreeBSDPkg) CheckUpdates

func (f *FreeBSDPkg) CheckUpdates(pkgs []model.Package) map[string]string

func (*FreeBSDPkg) Describe

func (f *FreeBSDPkg) Describe(pkgs []model.Package) map[string]string

func (*FreeBSDPkg) ListDependencies added in v0.2.0

func (f *FreeBSDPkg) ListDependencies(pkgs []model.Package) map[string][]string

func (*FreeBSDPkg) Name

func (f *FreeBSDPkg) Name() model.Source

func (*FreeBSDPkg) Scan

func (f *FreeBSDPkg) Scan() ([]model.Package, error)

type Gem

type Gem struct{}

func (*Gem) Available

func (g *Gem) Available() bool

func (*Gem) CheckUpdates

func (g *Gem) CheckUpdates(pkgs []model.Package) map[string]string

func (*Gem) Describe

func (g *Gem) Describe(pkgs []model.Package) map[string]string

func (*Gem) ListDependencies added in v0.2.0

func (g *Gem) ListDependencies(pkgs []model.Package) map[string][]string

func (*Gem) Name

func (g *Gem) Name() model.Source

func (*Gem) RemoveCmd added in v0.3.0

func (g *Gem) RemoveCmd(name string) *exec.Cmd

func (*Gem) Scan

func (g *Gem) Scan() ([]model.Package, error)

func (*Gem) UpgradeCmd added in v0.2.13

func (g *Gem) UpgradeCmd(name string) *exec.Cmd

type Go

type Go struct{}

func (*Go) Available

func (g *Go) Available() bool

func (*Go) Name

func (g *Go) Name() model.Source

func (*Go) Scan

func (g *Go) Scan() ([]model.Package, error)

type Guix added in v0.2.0

type Guix struct{}

func (*Guix) Available added in v0.2.0

func (g *Guix) Available() bool

func (*Guix) CheckUpdates added in v0.2.0

func (g *Guix) CheckUpdates(pkgs []model.Package) map[string]string

func (*Guix) Describe added in v0.2.0

func (g *Guix) Describe(pkgs []model.Package) map[string]string

func (*Guix) ListDependencies added in v0.2.0

func (g *Guix) ListDependencies(pkgs []model.Package) map[string][]string

func (*Guix) Name added in v0.2.0

func (g *Guix) Name() model.Source

func (*Guix) Scan added in v0.2.0

func (g *Guix) Scan() ([]model.Package, error)

type Installer added in v0.3.0

type Installer interface {
	InstallCmd(name string) *exec.Cmd
}

Installer is implemented by managers that can install a new package.

type Luarocks

type Luarocks struct{}

func (*Luarocks) Available

func (l *Luarocks) Available() bool

func (*Luarocks) CheckUpdates

func (l *Luarocks) CheckUpdates(pkgs []model.Package) map[string]string

func (*Luarocks) Describe

func (l *Luarocks) Describe(pkgs []model.Package) map[string]string

func (*Luarocks) ListDependencies added in v0.2.0

func (l *Luarocks) ListDependencies(pkgs []model.Package) map[string][]string

func (*Luarocks) Name

func (l *Luarocks) Name() model.Source

func (*Luarocks) RemoveCmd added in v0.3.0

func (l *Luarocks) RemoveCmd(name string) *exec.Cmd

func (*Luarocks) Scan

func (l *Luarocks) Scan() ([]model.Package, error)

func (*Luarocks) UpgradeCmd added in v0.2.13

func (l *Luarocks) UpgradeCmd(name string) *exec.Cmd

type MacPorts

type MacPorts struct{}

func (*MacPorts) Available

func (m *MacPorts) Available() bool

func (*MacPorts) CheckUpdates

func (m *MacPorts) CheckUpdates(pkgs []model.Package) map[string]string

func (*MacPorts) Describe

func (m *MacPorts) Describe(pkgs []model.Package) map[string]string

func (*MacPorts) ListDependencies added in v0.2.0

func (m *MacPorts) ListDependencies(pkgs []model.Package) map[string][]string

func (*MacPorts) Name

func (m *MacPorts) Name() model.Source

func (*MacPorts) Scan

func (m *MacPorts) Scan() ([]model.Package, error)

type Manager

type Manager interface {
	Name() model.Source
	Available() bool
	Scan() ([]model.Package, error)
}

Manager scans a package manager and returns its installed packages.

func All

func All() []Manager

All returns every known manager.

func BySource added in v0.2.13

func BySource(source model.Source) Manager

BySource returns the manager responsible for the provided source, if any.

type Mas

type Mas struct{}

func (*Mas) Available

func (m *Mas) Available() bool

func (*Mas) CheckUpdates

func (m *Mas) CheckUpdates(pkgs []model.Package) map[string]string

func (*Mas) Name

func (m *Mas) Name() model.Source

func (*Mas) Scan

func (m *Mas) Scan() ([]model.Package, error)

type Nix

type Nix struct{}

func (*Nix) Available

func (n *Nix) Available() bool

func (*Nix) Describe

func (n *Nix) Describe(pkgs []model.Package) map[string]string

func (*Nix) ListDependencies added in v0.2.0

func (n *Nix) ListDependencies(pkgs []model.Package) map[string][]string

func (*Nix) Name

func (n *Nix) Name() model.Source

func (*Nix) Scan

func (n *Nix) Scan() ([]model.Package, error)

type Npm

type Npm struct{}

func (*Npm) Available

func (n *Npm) Available() bool

func (*Npm) CheckUpdates

func (n *Npm) CheckUpdates(pkgs []model.Package) map[string]string

func (*Npm) Describe

func (n *Npm) Describe(pkgs []model.Package) map[string]string

func (*Npm) InstallCmd added in v0.3.0

func (n *Npm) InstallCmd(name string) *exec.Cmd

func (*Npm) ListDependencies added in v0.2.0

func (n *Npm) ListDependencies(pkgs []model.Package) map[string][]string

func (*Npm) Name

func (n *Npm) Name() model.Source

func (*Npm) RemoveCmd added in v0.3.0

func (n *Npm) RemoveCmd(name string) *exec.Cmd

func (*Npm) Scan

func (n *Npm) Scan() ([]model.Package, error)

func (*Npm) Search added in v0.3.0

func (n *Npm) Search(query string) ([]model.Package, error)

func (*Npm) UpgradeCmd added in v0.2.13

func (n *Npm) UpgradeCmd(name string) *exec.Cmd

type Nuget added in v0.2.0

type Nuget struct{}

Nuget surfaces packages from the local NuGet global package cache (~/.nuget/packages). This is intentionally cross-platform: the cache exists wherever the .NET SDK is installed, including macOS and Linux. Do not add a runtime.GOOS == "windows" guard here.

func (*Nuget) Available added in v0.2.0

func (n *Nuget) Available() bool

Available returns true when the NuGet global package cache directory exists.

func (*Nuget) Name added in v0.2.0

func (n *Nuget) Name() model.Source

func (*Nuget) Scan added in v0.2.0

func (n *Nuget) Scan() ([]model.Package, error)

Scan enumerates packages in ~/.nuget/packages. Each subdirectory is a package name; its subdirectories are installed versions. The latest (semver-highest) version is reported for each package.

type Opam

type Opam struct{}

func (*Opam) Available

func (o *Opam) Available() bool

func (*Opam) CheckUpdates

func (o *Opam) CheckUpdates(pkgs []model.Package) map[string]string

func (*Opam) Describe

func (o *Opam) Describe(pkgs []model.Package) map[string]string

func (*Opam) ListDependencies added in v0.2.0

func (o *Opam) ListDependencies(pkgs []model.Package) map[string][]string

func (*Opam) Name

func (o *Opam) Name() model.Source

func (*Opam) RemoveCmd added in v0.3.0

func (o *Opam) RemoveCmd(name string) *exec.Cmd

func (*Opam) Scan

func (o *Opam) Scan() ([]model.Package, error)

func (*Opam) UpgradeCmd added in v0.2.13

func (o *Opam) UpgradeCmd(name string) *exec.Cmd

type Pacman

type Pacman struct{}

func (*Pacman) Available

func (p *Pacman) Available() bool

func (*Pacman) CheckUpdates

func (p *Pacman) CheckUpdates(pkgs []model.Package) map[string]string

func (*Pacman) Describe

func (p *Pacman) Describe(pkgs []model.Package) map[string]string

func (*Pacman) InstallCmd added in v0.3.0

func (p *Pacman) InstallCmd(name string) *exec.Cmd

func (*Pacman) ListDependencies added in v0.2.0

func (p *Pacman) ListDependencies(pkgs []model.Package) map[string][]string

func (*Pacman) Name

func (p *Pacman) Name() model.Source

func (*Pacman) RemoveCmd added in v0.3.0

func (p *Pacman) RemoveCmd(name string) *exec.Cmd

func (*Pacman) RemoveCmdWithDeps added in v0.3.0

func (p *Pacman) RemoveCmdWithDeps(name string) *exec.Cmd

func (*Pacman) Scan

func (p *Pacman) Scan() ([]model.Package, error)

func (*Pacman) Search added in v0.3.0

func (p *Pacman) Search(query string) ([]model.Package, error)

func (*Pacman) UpgradeCmd added in v0.2.13

func (p *Pacman) UpgradeCmd(name string) *exec.Cmd

type Pip

type Pip struct{}

func (*Pip) Available

func (p *Pip) Available() bool

func (*Pip) CheckUpdates

func (p *Pip) CheckUpdates(pkgs []model.Package) map[string]string

func (*Pip) Describe

func (p *Pip) Describe(pkgs []model.Package) map[string]string

func (*Pip) InstallCmd added in v0.3.0

func (p *Pip) InstallCmd(name string) *exec.Cmd

func (*Pip) ListDependencies added in v0.2.0

func (p *Pip) ListDependencies(pkgs []model.Package) map[string][]string

func (*Pip) Name

func (p *Pip) Name() model.Source

func (*Pip) RemoveCmd added in v0.3.0

func (p *Pip) RemoveCmd(name string) *exec.Cmd

func (*Pip) Scan

func (p *Pip) Scan() ([]model.Package, error)

func (*Pip) Search added in v0.3.0

func (p *Pip) Search(query string) ([]model.Package, error)

func (*Pip) UpgradeCmd added in v0.2.13

func (p *Pip) UpgradeCmd(name string) *exec.Cmd

type Pipx

type Pipx struct{}

func (*Pipx) Available

func (p *Pipx) Available() bool

func (*Pipx) Name

func (p *Pipx) Name() model.Source

func (*Pipx) RemoveCmd added in v0.3.0

func (p *Pipx) RemoveCmd(name string) *exec.Cmd

func (*Pipx) Scan

func (p *Pipx) Scan() ([]model.Package, error)

func (*Pipx) UpgradeCmd added in v0.2.13

func (p *Pipx) UpgradeCmd(name string) *exec.Cmd

type Pkgsrc

type Pkgsrc struct{}

func (*Pkgsrc) Available

func (p *Pkgsrc) Available() bool

func (*Pkgsrc) Describe

func (p *Pkgsrc) Describe(pkgs []model.Package) map[string]string

func (*Pkgsrc) ListDependencies added in v0.2.0

func (p *Pkgsrc) ListDependencies(pkgs []model.Package) map[string][]string

func (*Pkgsrc) Name

func (p *Pkgsrc) Name() model.Source

func (*Pkgsrc) Scan

func (p *Pkgsrc) Scan() ([]model.Package, error)

type Pnpm

type Pnpm struct{}

func (*Pnpm) Available

func (n *Pnpm) Available() bool

func (*Pnpm) CheckUpdates

func (n *Pnpm) CheckUpdates(pkgs []model.Package) map[string]string

func (*Pnpm) Describe

func (n *Pnpm) Describe(pkgs []model.Package) map[string]string

func (*Pnpm) ListDependencies added in v0.2.0

func (n *Pnpm) ListDependencies(pkgs []model.Package) map[string][]string

func (*Pnpm) Name

func (n *Pnpm) Name() model.Source

func (*Pnpm) Scan

func (n *Pnpm) Scan() ([]model.Package, error)

type Portage added in v0.2.0

type Portage struct{}

func (*Portage) Available added in v0.2.0

func (p *Portage) Available() bool

func (*Portage) CheckUpdates added in v0.2.0

func (p *Portage) CheckUpdates(pkgs []model.Package) map[string]string

func (*Portage) Describe added in v0.2.0

func (p *Portage) Describe(pkgs []model.Package) map[string]string

func (*Portage) ListDependencies added in v0.2.0

func (p *Portage) ListDependencies(pkgs []model.Package) map[string][]string

func (*Portage) Name added in v0.2.0

func (p *Portage) Name() model.Source

func (*Portage) Scan added in v0.2.0

func (p *Portage) Scan() ([]model.Package, error)

type PowerShell added in v0.2.0

type PowerShell struct{}

PowerShell surfaces installed PowerShell modules via Get-Module -ListAvailable. Works with both Windows PowerShell (powershell.exe) and PowerShell Core (pwsh). pwsh runs on macOS and Linux too, so this manager is not Windows-only by design.

func (*PowerShell) Available added in v0.2.0

func (ps *PowerShell) Available() bool

func (*PowerShell) Describe added in v0.2.0

func (ps *PowerShell) Describe(pkgs []model.Package) map[string]string

Describe returns module descriptions, reusing cached Scan() data when available to avoid spawning a second PowerShell process.

func (*PowerShell) Name added in v0.2.0

func (ps *PowerShell) Name() model.Source

func (*PowerShell) Scan added in v0.2.0

func (ps *PowerShell) Scan() ([]model.Package, error)

Scan lists installed PowerShell modules. Fetches Name, Version, and Description in a single invocation and caches the result for Describe() to consume.

type Remover added in v0.3.0

type Remover interface {
	RemoveCmd(name string) *exec.Cmd
}

Remover is implemented by managers that can remove a single package.

type Scoop added in v0.2.0

type Scoop struct{}

Scoop manages packages via the Scoop command-line installer for Windows.

func (*Scoop) Available added in v0.2.0

func (s *Scoop) Available() bool

func (*Scoop) CheckUpdates added in v0.2.0

func (s *Scoop) CheckUpdates(_ []model.Package) map[string]string

CheckUpdates runs `scoop status` to find packages with available updates.

func (*Scoop) InstallCmd added in v0.3.0

func (s *Scoop) InstallCmd(name string) *exec.Cmd

func (*Scoop) Name added in v0.2.0

func (s *Scoop) Name() model.Source

func (*Scoop) RemoveCmd added in v0.3.0

func (s *Scoop) RemoveCmd(name string) *exec.Cmd

func (*Scoop) Scan added in v0.2.0

func (s *Scoop) Scan() ([]model.Package, error)

Scan lists all installed Scoop packages. Modern Scoop (2022+) renders a tabular format with a separator line; older versions print " name version [bucket]" per line — both are handled.

func (*Scoop) Search added in v0.3.0

func (s *Scoop) Search(query string) ([]model.Package, error)

func (*Scoop) UpgradeCmd added in v0.2.13

func (s *Scoop) UpgradeCmd(name string) *exec.Cmd

type Searcher added in v0.3.0

type Searcher interface {
	Search(query string) ([]model.Package, error)
}

Searcher is implemented by managers that can search for available packages.

type Snap

type Snap struct{}

func (*Snap) Available

func (s *Snap) Available() bool

func (*Snap) CheckUpdates

func (s *Snap) CheckUpdates(pkgs []model.Package) map[string]string

func (*Snap) Describe

func (s *Snap) Describe(pkgs []model.Package) map[string]string

func (*Snap) InstallCmd added in v0.3.0

func (s *Snap) InstallCmd(name string) *exec.Cmd

func (*Snap) ListDependencies added in v0.2.0

func (s *Snap) ListDependencies(pkgs []model.Package) map[string][]string

func (*Snap) Name

func (s *Snap) Name() model.Source

func (*Snap) RemoveCmd added in v0.3.0

func (s *Snap) RemoveCmd(name string) *exec.Cmd

func (*Snap) Scan

func (s *Snap) Scan() ([]model.Package, error)

func (*Snap) Search added in v0.3.0

func (s *Snap) Search(query string) ([]model.Package, error)

func (*Snap) UpgradeCmd added in v0.2.13

func (s *Snap) UpgradeCmd(name string) *exec.Cmd

type UpdateCache

type UpdateCache struct {
	// contains filtered or unexported fields
}

UpdateCache persists update info to disk with a 7-day TTL.

func NewUpdateCache

func NewUpdateCache() *UpdateCache

func (*UpdateCache) Flush

func (uc *UpdateCache) Flush()

func (*UpdateCache) Get

func (uc *UpdateCache) Get(key string) (string, bool)

func (*UpdateCache) Invalidate added in v0.2.13

func (uc *UpdateCache) Invalidate(keys []string)

func (*UpdateCache) Set

func (uc *UpdateCache) Set(key, latest string)

type UpdateChecker

type UpdateChecker interface {
	// CheckUpdates returns a map of package name → latest available version.
	CheckUpdates(pkgs []model.Package) map[string]string
}

UpdateChecker is implemented by managers that can check for available updates.

type Upgrader added in v0.2.13

type Upgrader interface {
	// UpgradeCmd returns the command to upgrade a single package.
	// The caller is responsible for executing it (typically via tea.ExecProcess
	// so the user sees output and can interact with prompts like sudo).
	UpgradeCmd(name string) *exec.Cmd
}

Upgrader is implemented by managers that can upgrade a single package.

type WindowsUpdates added in v0.2.0

type WindowsUpdates struct{}

func (*WindowsUpdates) Available added in v0.2.0

func (w *WindowsUpdates) Available() bool

func (*WindowsUpdates) Name added in v0.2.0

func (w *WindowsUpdates) Name() model.Source

func (*WindowsUpdates) Scan added in v0.2.0

func (w *WindowsUpdates) Scan() ([]model.Package, error)

Scan queries for pending Windows updates via the Windows Update COM API. Returns one Package entry per pending update; returns nil on any failure.

type Winget added in v0.2.0

type Winget struct{}

Winget manages packages via the Windows Package Manager (winget).

func (*Winget) Available added in v0.2.0

func (w *Winget) Available() bool

func (*Winget) CheckUpdates added in v0.2.0

func (w *Winget) CheckUpdates(_ []model.Package) map[string]string

CheckUpdates runs `winget upgrade` and returns available version per package name.

func (*Winget) InstallCmd added in v0.3.0

func (w *Winget) InstallCmd(name string) *exec.Cmd

func (*Winget) Name added in v0.2.0

func (w *Winget) Name() model.Source

func (*Winget) RemoveCmd added in v0.3.0

func (w *Winget) RemoveCmd(name string) *exec.Cmd

func (*Winget) Scan added in v0.2.0

func (w *Winget) Scan() ([]model.Package, error)

Scan lists all installed packages. Tries JSON output first (winget 1.5+), then falls back to fixed-width text parsing.

func (*Winget) Search added in v0.3.0

func (w *Winget) Search(query string) ([]model.Package, error)

func (*Winget) UpgradeCmd added in v0.2.13

func (w *Winget) UpgradeCmd(name string) *exec.Cmd

type Xbps added in v0.2.0

type Xbps struct{}

func (*Xbps) Available added in v0.2.0

func (x *Xbps) Available() bool

func (*Xbps) CheckUpdates added in v0.2.0

func (x *Xbps) CheckUpdates(pkgs []model.Package) map[string]string

func (*Xbps) Describe added in v0.2.0

func (x *Xbps) Describe(pkgs []model.Package) map[string]string

func (*Xbps) ListDependencies added in v0.2.0

func (x *Xbps) ListDependencies(pkgs []model.Package) map[string][]string

func (*Xbps) Name added in v0.2.0

func (x *Xbps) Name() model.Source

func (*Xbps) RemoveCmd added in v0.3.0

func (x *Xbps) RemoveCmd(name string) *exec.Cmd

func (*Xbps) RemoveCmdWithDeps added in v0.3.0

func (x *Xbps) RemoveCmdWithDeps(name string) *exec.Cmd

func (*Xbps) Scan added in v0.2.0

func (x *Xbps) Scan() ([]model.Package, error)

func (*Xbps) UpgradeCmd added in v0.2.13

func (x *Xbps) UpgradeCmd(name string) *exec.Cmd

Jump to

Keyboard shortcuts

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