Documentation
¶
Index ¶
- Constants
- func BuiltinNames() []string
- type CommandResult
- type ExecRunner
- type Failure
- type Manager
- type Package
- type Runner
- type Service
- func (s Service) List(ctx context.Context, only ...string) ([]Package, []Failure, error)
- func (s Service) Manager(name string) (Manager, bool)
- func (s Service) Names() []string
- func (s Service) Outdated(ctx context.Context, only ...string) ([]Package, []Failure, error)
- func (s Service) Path(manager Manager) (string, bool)
- func (s Service) Resolve(ref string) (Manager, string, bool)
- func (s Service) Upgrade(ctx context.Context, managerName string, names []string) (UpgradeResult, error)
- type UpgradeResult
Constants ¶
const ( ParserNPMJSON = "npm-json" ParserPNPMJSON = "pnpm-json" ParserPipxJSON = "pipx-json" ParserUVToolText = "uv-tool-text" ParserCargoText = "cargo-text" ParserBunText = "bun-text" ParserScoopTable = "scoop-table" ParserLinesRegex = "lines-regex" )
Parser identifiers for built-in manager output formats. Each manager names one parser for list output and reuses it for outdated output.
const DefaultTimeout = 60 * time.Second
DefaultTimeout bounds one manager command.
Variables ¶
This section is empty.
Functions ¶
func BuiltinNames ¶ added in v1.10.2
func BuiltinNames() []string
BuiltinNames lists the built-in manager names in display order.
Types ¶
type CommandResult ¶
CommandResult is the outcome of one manager command. All three parts matter: npm exits non-zero when it finds outdated packages and reports errors on stdout, while pipx keeps stdout clean and writes its notes to stderr.
type ExecRunner ¶
type ExecRunner struct{}
ExecRunner runs manager commands as child processes.
It deliberately inherits the parent environment and does not inject eget's own proxy settings: each manager has its own registry/proxy configuration.
type Failure ¶
Failure is a manager-level failure, e.g. the manager command failed or its output could not be parsed. It is reported per manager so one broken manager never hides the others.
type Manager ¶
type Manager struct {
Name string
Bin string
ListArgs []string
OutdatedArgs []string
UpgradeArgs []string
UpgradeAllArgs []string
Parser string
ListRegex string
OutdatedRegex string
Enabled bool
Timeout time.Duration
}
Manager describes how to drive one external package manager.
func Managers ¶
Managers merges the built-in adapters with the [ext.<name>] config sections:
- a section named after a builtin overrides that builtin
- enabled = false removes the manager (builtin or configured)
- an unknown name adds a new manager
The result is sorted by name and always carries a usable Bin, Parser and Timeout.
func (Manager) SupportsList ¶
SupportsList reports whether the manager can list installed packages.
func (Manager) SupportsOutdated ¶
SupportsOutdated reports whether the manager can detect outdated packages. uv tool list --outdated and friends; cargo has no built-in equivalent.
type Package ¶
Package is one package installed by an external manager.
func ParseList ¶
func ParseList(manager Manager, res CommandResult) ([]Package, error)
ParseList parses the output of a manager's list command into installed packages. An empty slice is a valid result: no packages are installed.
func ParseOutdated ¶
func ParseOutdated(manager Manager, res CommandResult) ([]Package, error)
ParseOutdated parses the output of a manager's outdated command, which only reports the packages that are behind.
type Runner ¶
type Runner interface {
Run(ctx context.Context, bin string, args []string, timeout time.Duration) (CommandResult, error)
}
Runner runs one manager command. It is an interface so tests can drive the service without any manager installed.
func NewExecRunner ¶
func NewExecRunner() Runner
type Service ¶
Service lists and upgrades packages owned by external managers.
func NewService ¶
NewService builds the service from config, using the real process runner.
func (Service) List ¶
List returns the packages installed by the given managers (all of them when only is empty). Managers that are missing or fail are reported as failures instead of aborting the rest.
func (Service) Outdated ¶
Outdated returns the packages that are behind, using only the managers that can detect it.
func (Service) Path ¶
Path reports the resolved binary path of a manager. A configured bin that contains a path separator is used as-is, which is the escape hatch for tools installed outside PATH (pipx, cargo, ...).
func (Service) Resolve ¶
Resolve splits a "<manager>:<pkg>" reference. An empty manager name or an unknown manager is not a valid reference.
func (Service) Upgrade ¶
func (s Service) Upgrade(ctx context.Context, managerName string, names []string) (UpgradeResult, error)
Upgrade runs the upgrade command of one manager. names may be empty, which means "the whole manager": that uses the manager's upgrade-all command when it has one, otherwise every installed package is upgraded by name.
The returned From/To fields are left empty: the caller already knows the versions under check.