snap

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package snap provides an implementation of the syspkg manager interface for the snap package manager. It provides a Go (golang) API interface for interacting with the snap package manager. It allows you to query, install, and remove packages, and supports package managers like Apt, Snap, and Flatpak. This package is a wrapper around the snap command line tool.

Snap is a software deployment and package management system originally designed and built by Canonical, the company behind the Ubuntu Linux distribution. Snap packages are self-contained applications running in a sandbox with mediated access to the host system. Snap packages have no dependency on any libraries or packages installed on the host system, designed to work on any Linux distribution that has snap support installed. Snap packages are available from the Snap Store, an app store with an audience of millions, and also available from other sources, including the Ubuntu Store, the KDE Discover Store, and the elementary AppCenter.

For more information, see:

This package is part of the syspkg library.

Index

Constants

View Source
const (
	ArgsAssumeYes    string = "-y"
	ArgsAssumeNo     string = "--assume-no"
	ArgsDryRun       string = "--dry-run"
	ArgsFixBroken    string = ""
	ArgsQuiet        string = "-qq"
	ArgsPurge        string = "--purge"
	ArgsAutoRemove   string = "--autoremove"
	ArgsShowProgress string = "--show-progress"
)

Constants for various command line arguments used by the snap package manager.

Variables

View Source
var ENV_NonInteractive []string = []string{"LC_ALL=C"}

ENV_NonInteractive is an environment variable configuration to set non-interactive mode for package manager commands.

Functions

func ParseFindOutput

func ParseFindOutput(msg string, opts *manager.Options) []manager.PackageInfo

ParseFindOutput parses the output of `snap search` command and returns a list of PackageInfo

Example output: Name Version Publisher Notes Summary blablaland-desktop 1.0.1 adedev - Blablaland Desktop

func ParseInstallOutput

func ParseInstallOutput(msg string, opts *manager.Options) []manager.PackageInfo

ParseInstallOutput parses the output of `snap install` command and returns a list of PackageInfo

Example output: snap "deja-dup" is already installed, see 'snap help refresh' blablaland-desktop (edge) 1.0.1 from AdeDev installed

func ParseListInstalledOutput

func ParseListInstalledOutput(msg string, opts *manager.Options) []manager.PackageInfo

ParseListInstalledOutput parses the output of `snap list` command and returns a list of PackageInfo

Example output: Name Version Rev Tracking Publisher Notes bare 1.0 5 latest/stable canonical✓ base blablaland-desktop 1.0.1 3 latest/edge adedev - canonical-livepatch 10.5.3 196 latest/stable canonical✓ - caprine 2.57.0 53 latest/stable sindresorhus -

func ParseListOutput

func ParseListOutput(msg string, opts *manager.Options) []manager.PackageInfo

func ParseListUpgradableOutput

func ParseListUpgradableOutput(msg string, opts *manager.Options) []manager.PackageInfo

ParseListUpgradableOutput parses the output of `snap refresh --list` command and returns a list of PackageInfo

Example msg: bluet@ocisly:~/workspace/go-syspkg$ snap refresh --list Name Version Rev Size Publisher Notes firefox 112.0.1-1 2579 253MB mozilla✓ - gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 198 172MB canonical✓ - bluet@ocisly:~/workspace/go-syspkg$ snap list|grep firefox firefox 112.0-2 2559 latest/stable mozilla** -

func ParsePackageInfoOutput

func ParsePackageInfoOutput(msg string, opts *manager.Options) manager.PackageInfo

cspell: disable ParsePackageInfoOutput parses the output of `snap info` command and returns a list of PackageInfo

Example msg: name: blablaland-desktop summary: Blablaland Desktop publisher: AdeDev store-url: https://snapcraft.io/blablaland-desktop license: unset description: |

Version bureau du jeu Blablaland (inclus Flash Player)

snap-id: yEfmuhiQDVy5B2rxNLaPyUYOE6iJakwr channels:

latest/stable:    –
latest/candidate: –
latest/beta:      –
latest/edge:      1.0.1 2021-06-08 (3) 112MB -

cspell: enable

func ParseSearchOutput

func ParseSearchOutput(msg string, opts *manager.Options) []manager.PackageInfo

ParseDeletedOutput parses the output of `snap search` command and returns a list of PackageInfo

Example output: Name Version Publisher Notes Summary blablaland-desktop 1.0.1 adedev - Blablaland Desktop

Types

type PackageManager

type PackageManager struct{}

PackageManager is an empty struct that implements the manager.PackageManager interface for the snap package manager.

func (*PackageManager) Delete

func (a *PackageManager) Delete(pkgs []string, opts *manager.Options) ([]manager.PackageInfo, error)

Delete removes the specified packages using the snap package manager with the provided options.

func (*PackageManager) Find

func (a *PackageManager) Find(keywords []string, opts *manager.Options) ([]manager.PackageInfo, error)

Find searches for packages matching the provided keywords using the snap package manager.

func (*PackageManager) GetPackageInfo

func (a *PackageManager) GetPackageInfo(pkg string, opts *manager.Options) (manager.PackageInfo, error)

GetPackageInfo retrieves information about the specified package using the snap package manager.

func (*PackageManager) GetPackageManager

func (a *PackageManager) GetPackageManager() string

GetPackageManager returns the package manager name (in this case, "snap").

func (*PackageManager) Install

func (a *PackageManager) Install(pkgs []string, opts *manager.Options) ([]manager.PackageInfo, error)

Install installs the specified packages using the snap package manager with the provided options.

func (*PackageManager) IsAvailable

func (a *PackageManager) IsAvailable() bool

IsAvailable checks if the snap package manager is available on the system.

func (*PackageManager) ListInstalled

func (a *PackageManager) ListInstalled(opts *manager.Options) ([]manager.PackageInfo, error)

ListInstalled lists all installed packages using the snap package manager.

func (*PackageManager) ListUpgradable

func (a *PackageManager) ListUpgradable(opts *manager.Options) ([]manager.PackageInfo, error)

ListUpgradable lists all upgradable packages using the snap package manager.

func (*PackageManager) Refresh

func (a *PackageManager) Refresh(opts *manager.Options) error

Refresh refreshes the package index for the snap package manager. Currently not implemented.

func (*PackageManager) Upgrade added in v0.1.4

func (a *PackageManager) Upgrade(pkgs []string, opts *manager.Options) ([]manager.PackageInfo, error)

Upgrade upgrades the specified packages using the snap package manager with the provided options.

func (*PackageManager) UpgradeAll

func (a *PackageManager) UpgradeAll(opts *manager.Options) ([]manager.PackageInfo, error)

UpgradeAll upgrades all upgradable packages using the snap package manager with the provided options.

Jump to

Keyboard shortcuts

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