scoop

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DetailFieldBin          = "bin"
	DetailFieldShortcuts    = "shortcuts"
	DetailFieldUrl          = "url"
	DetailFieldArchitecture = "architecture"
	DetailFieldDescription  = "description"
	DetailFieldVersion      = "version"
	DetailFieldNotes        = "notes"
	DetailFieldDepends      = "depends"
	DetailFieldEnvSet       = "env_set"
	DetailFieldEnvAddPath   = "env_add_path"
	DetailFieldExtractDir   = "extract_dir"
	DetailFieldExtractTo    = "extract_to"
	DetailFieldPostInstall  = "post_install"
	DetailFieldPreInstall   = "pre_install"
	DetailFieldInstaller    = "installer"
	DetailFieldInnoSetup    = "innosetup"
)

Variables

View Source
var ErrBucketNoGitDir = errors.New(".git dir at path not found")
View Source
var ErrBucketNotFound = errors.New("bucket not found")

Functions

func CachePath

func CachePath(app, version, url string) string

CachePath generates a path given the app, a version and the target URL. The rules defined here are taken from the scoop code.

func GetDefaultScoopDir added in v0.0.3

func GetDefaultScoopDir() (string, error)

func ParseAppIdentifier added in v0.0.3

func ParseAppIdentifier(name string) (string, string, string)

ParseAppIdentifier returns all fragments of an app. The fragments are (in order) (bucket, name, version). Not that `bucket` and `version` can be empty.

Types

type App

type App struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Notes       string `json:"notes"`

	Bin        []Bin    `json:"bin"`
	Shortcuts  []Bin    `json:"shortcuts"`
	EnvAddPath []string `json:"env_add_path"`
	EnvSet     []EnvVar `json:"env_set"`

	Depends      []Dependency                      `json:"depends"`
	URL          []string                          `json:"url"`
	Architecture map[ArchitectureKey]*Architecture `json:"architecture"`
	InnoSetup    bool                              `json:"innosetup"`
	Installer    *Installer                        `json:"installer"`
	PreInstall   []string                          `json:"pre_install"`
	PostInstall  []string                          `json:"post_install"`
	ExtractTo    []string                          `json:"extract_to"`
	// ExtractDir specifies which dir should be extracted from the downloaded
	// archive. However, there might be more URLs than there are URLs.
	ExtractDir []string `json:"extract_dir"`

	Bucket *Bucket `json:"-"`
	// contains filtered or unexported fields
}

App represents an application, which may or may not be installed and may or may not be part of a bucket. "Headless" manifests are also a thing, for example when you are using an auto-generated manifest for a version that's not available anymore. In that case, scoop will lose the bucket information.

func (*App) AvailableVersions added in v0.0.3

func (a *App) AvailableVersions() ([]string, error)

func (*App) AvailableVersionsN added in v0.0.4

func (a *App) AvailableVersionsN(maxVersions int) ([]string, error)

func (*App) LoadDetails

func (a *App) LoadDetails(fields ...string) error

LoadDetails will load additional data regarding the manifest, such as description and version information. This causes IO on your drive and therefore isn't done by default.

func (*App) LoadDetailsWithIter added in v0.0.3

func (a *App) LoadDetailsWithIter(iter *jsoniter.Iterator, fields ...string) error

LoadDetails will load additional data regarding the manifest, such as description and version information. This causes IO on your drive and therefore isn't done by default.

func (*App) ManifestForVersion added in v0.0.3

func (a *App) ManifestForVersion(targetVersion string) (io.ReadCloser, error)

ManifestForVersion will search through history til a version equal to the desired version is found. Note that we compare the versions and stop searching if a lower version is encountered. This function is expected to be very slow, be warned!

func (App) ManifestPath

func (a App) ManifestPath() string

type Architecture added in v0.0.3

type Architecture struct {
	Items []ArchitectureItem `json:"items"`

	Bin       []Bin
	Shortcuts []Bin

	// Installer replaces MSI
	Installer Installer

	// PreInstall contains a list of commands to execute before installation.
	// Note that PreUninstall isn't supported in ArchitectureItem, even though
	// Uninstaller is supported.
	PreInstall []string
	// PreInstall contains a list of commands to execute after installation.
	// Note that PostUninstall isn't supported in ArchitectureItem, even though
	// Uninstaller is supported.
	PostInstall []string
}

type ArchitectureItem added in v0.0.3

type ArchitectureItem struct {
	URL        string
	Hash       string
	ExtractDir string
}

type ArchitectureKey added in v0.0.3

type ArchitectureKey string
const (
	// Architecture32Bit is for x386 (intel/amd). It is the default if no arch
	// has been specified.
	ArchitectureKey32Bit ArchitectureKey = "32bit"
	// Architecture32Bit is for x686 (intel/amd)
	ArchitectureKey64Bit ArchitectureKey = "64bit"
	ArchitectureKeyARM64 ArchitectureKey = "arm64"
)

type Bin added in v0.0.3

type Bin struct {
	Name  string
	Alias string
	Args  []string
}

type Bucket

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

func (*Bucket) AvailableApps

func (b *Bucket) AvailableApps() ([]*App, error)

AvailableApps returns unloaded app manifests. You need to call App.LoadDetails on each one. This allows for optimisation by parallelisation where desired.

func (*Bucket) Dir

func (b *Bucket) Dir() string

Dir is the bucket directory, which contains the subdirectory "bucket" with the manifests.

func (*Bucket) GetApp added in v0.0.3

func (b *Bucket) GetApp(name string) *App

func (*Bucket) ManifestDir

func (b *Bucket) ManifestDir() string

ManifestDir is the directory path of the bucket without a leading slash.

func (*Bucket) Name

func (b *Bucket) Name() string

Bucket is the directory name of the bucket and therefore name of the bucket.

func (*Bucket) Remove

func (b *Bucket) Remove() error

Remove removes the bucket, but doesn't unisntall any of its installed applications.

type Dependencies added in v0.0.3

type Dependencies struct {
	App    *App
	Values []*Dependencies
}

type Dependency added in v0.0.3

type Dependency struct {
	Bucket string
	Name   string
}

type EnvVar added in v0.0.3

type EnvVar struct {
	Key, Value string
}

type InstalledApp added in v0.0.3

type InstalledApp struct {
	*App
	// Hold indicates whether the app should be kept on the currently installed
	// version. It's versioning pinning.
	Hold bool
}

type Installer added in v0.0.3

type Installer struct {
	// File is the installer executable. If not specified, this will
	// autoamtically be set to the last item of the URLs.
	File   string
	Script []string
	Args   []string
	Keep   bool
}

type KnownBucket added in v0.0.4

type KnownBucket struct {
	Name string
	URL  string
}

type OutdatedApp added in v0.0.3

type OutdatedApp struct {
	*InstalledApp

	ManifestDeleted bool
	LatestVersion   string
}

type Scoop added in v0.0.3

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

func NewCustomScoop added in v0.0.3

func NewCustomScoop(scoopRoot string) *Scoop

func NewScoop added in v0.0.3

func NewScoop() (*Scoop, error)

func (*Scoop) DependencyTree added in v0.0.3

func (scoop *Scoop) DependencyTree(a *App) (*Dependencies, error)

func (*Scoop) GetAppsDir added in v0.0.3

func (scoop *Scoop) GetAppsDir() string

func (*Scoop) GetAvailableApp added in v0.0.3

func (scoop *Scoop) GetAvailableApp(name string) (*App, error)

func (*Scoop) GetBucket added in v0.0.3

func (scoop *Scoop) GetBucket(name string) *Bucket

GetBucket constructs a new bucket object pointing at the given bucket. At this point, the bucket might not necessarily exist.

func (*Scoop) GetBucketsDir added in v0.0.3

func (scoop *Scoop) GetBucketsDir() string

func (*Scoop) GetCacheDir added in v0.0.3

func (scoop *Scoop) GetCacheDir() string

func (*Scoop) GetInstalledApp added in v0.0.3

func (scoop *Scoop) GetInstalledApp(name string) (*InstalledApp, error)

func (*Scoop) GetInstalledApps added in v0.0.3

func (scoop *Scoop) GetInstalledApps() ([]*InstalledApp, error)

func (*Scoop) GetKnownBuckets added in v0.0.3

func (scoop *Scoop) GetKnownBuckets() ([]KnownBucket, error)

GetKnownBuckets returns the list of available "default" buckets that are available, but might have not necessarily been installed locally.

func (*Scoop) GetLocalBuckets added in v0.0.3

func (scoop *Scoop) GetLocalBuckets() ([]*Bucket, error)

GetLocalBuckets is an API representation of locally installed buckets.

func (*Scoop) GetOutdatedApps added in v0.0.3

func (scoop *Scoop) GetOutdatedApps() ([]*OutdatedApp, error)

func (*Scoop) GetScoopInstallationDir added in v0.0.3

func (scoop *Scoop) GetScoopInstallationDir() string

func (*Scoop) Install added in v0.0.3

func (scoop *Scoop) Install(apps []string, arch ArchitectureKey) error

func (*Scoop) LookupCache added in v0.0.3

func (scoop *Scoop) LookupCache(app, version string) ([]string, error)

LookupCache will check the cache dir for matching entries. Note that the `app` parameter must be non-empty, but the version is optional.

func (*Scoop) ReverseDependencyTree added in v0.0.3

func (scoop *Scoop) ReverseDependencyTree(apps []*App, app *App) *Dependencies

Jump to

Keyboard shortcuts

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