Documentation
¶
Overview ¶
Package apt provides package management operations via apt.
Index ¶
- type Darwin
- func (d *Darwin) Get(_ context.Context, _ string) (*Package, error)
- func (d *Darwin) Install(_ context.Context, _ string) (*Result, error)
- func (d *Darwin) List(_ context.Context) ([]Package, error)
- func (d *Darwin) ListUpdates(_ context.Context) ([]Update, error)
- func (d *Darwin) Remove(_ context.Context, _ string) (*Result, error)
- func (d *Darwin) Update(_ context.Context) (*Result, error)
- type Debian
- func (d *Debian) Get(_ context.Context, name string) (*Package, error)
- func (d *Debian) Install(_ context.Context, name string) (*Result, error)
- func (d *Debian) List(_ context.Context) ([]Package, error)
- func (d *Debian) ListUpdates(_ context.Context) ([]Update, error)
- func (d *Debian) Remove(_ context.Context, name string) (*Result, error)
- func (d *Debian) Update(_ context.Context) (*Result, error)
- type Linux
- func (l *Linux) Get(_ context.Context, _ string) (*Package, error)
- func (l *Linux) Install(_ context.Context, _ string) (*Result, error)
- func (l *Linux) List(_ context.Context) ([]Package, error)
- func (l *Linux) ListUpdates(_ context.Context) ([]Update, error)
- func (l *Linux) Remove(_ context.Context, _ string) (*Result, error)
- func (l *Linux) Update(_ context.Context) (*Result, error)
- type Package
- type Provider
- type Result
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Darwin ¶
type Darwin struct{}
Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as apt is not available on macOS.
func NewDarwinProvider ¶
func NewDarwinProvider() *Darwin
NewDarwinProvider factory to create a new Darwin instance.
func (*Darwin) ListUpdates ¶
ListUpdates returns ErrUnsupported on Darwin.
type Debian ¶
type Debian struct {
provider.FactsAware
// contains filtered or unexported fields
}
Debian implements the Provider interface for Debian-family systems using dpkg-query and apt-get.
func NewDebianProvider ¶
NewDebianProvider factory to create a new Debian instance.
func (*Debian) ListUpdates ¶
ListUpdates returns packages with available updates by parsing apt list --upgradable output.
type Linux ¶
type Linux struct{}
Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported; use the Debian provider for Debian-family systems.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
func (*Linux) ListUpdates ¶
ListUpdates returns ErrUnsupported on generic Linux.
type Package ¶
type Package struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Status string `json:"status"`
Size int64 `json:"size,omitempty"`
}
Package represents an installed apt package.
type Provider ¶
type Provider interface {
// List returns all installed packages.
List(ctx context.Context) ([]Package, error)
// Get returns details for a single installed package.
Get(ctx context.Context, name string) (*Package, error)
// Install installs a package by name.
Install(ctx context.Context, name string) (*Result, error)
// Remove removes a package by name.
Remove(ctx context.Context, name string) (*Result, error)
// Update refreshes the package index.
Update(ctx context.Context) (*Result, error)
// ListUpdates returns packages with available updates.
ListUpdates(ctx context.Context) ([]Update, error)
}
Provider implements the methods to interact with apt package management.