Documentation
¶
Index ¶
- Constants
- Variables
- func CachePath(app, version, url string) string
- func GetDefaultScoopDir() (string, error)
- func ParseAppIdentifier(name string) (string, string, string)
- type App
- func (a *App) AvailableVersions() ([]string, error)
- func (a *App) AvailableVersionsN(maxVersions int) ([]string, error)
- func (a *App) ForArch(arch ArchitectureKey) *AppResolved
- func (a *App) LoadDetails(fields ...string) error
- func (a *App) LoadDetailsWithIter(iter *jsoniter.Iterator, fields ...string) error
- func (a *App) ManifestForVersion(targetVersion string) (io.ReadSeeker, error)
- func (a *App) ManifestPath() string
- type AppResolved
- type Architecture
- type ArchitectureKey
- type Bin
- type Bucket
- type CacheHit
- type ChecksumMismatchError
- type Dependencies
- type Dependency
- type Downloadable
- type EnvVar
- type FinishedDownload
- type InstalledApp
- type Installer
- type KnownBucket
- type OutdatedApp
- type PersistDir
- type Scoop
- func (scoop *Scoop) AppDir() string
- func (scoop *Scoop) BucketDir() string
- func (scoop *Scoop) CacheDir() string
- func (scoop *Scoop) CreateShim(path string, bin Bin) error
- func (scoop *Scoop) DependencyTree(a *App) (*Dependencies, error)
- func (scoop *Scoop) FindAvailableApp(name string) (*App, error)
- func (scoop *Scoop) FindInstalledApp(name string) (*InstalledApp, error)
- func (scoop *Scoop) GetBucket(name string) *Bucket
- func (scoop *Scoop) GetKnownBuckets() ([]KnownBucket, error)
- func (scoop *Scoop) GetLocalBuckets() ([]*Bucket, error)
- func (scoop *Scoop) GetOutdatedApps() ([]*OutdatedApp, error)
- func (scoop *Scoop) Install(appName string, arch ArchitectureKey) error
- func (scoop *Scoop) InstallAll(appNames []string, arch ArchitectureKey) []error
- func (scoop *Scoop) InstalledApps() ([]*InstalledApp, error)
- func (scoop *Scoop) LookupCache(app, version string) ([]string, error)
- func (scoop *Scoop) PersistDir() string
- func (scoop *Scoop) RemoveShims(bins ...Bin) error
- func (scoop *Scoop) ReverseDependencyTree(apps []*App, app *App) *Dependencies
- func (scoop *Scoop) ScoopInstallationDir() string
- func (scoop *Scoop) ShimDir() string
- func (scoop Scoop) ShortcutDir() (string, error)
- func (scoop *Scoop) Uninstall(app *InstalledApp, arch ArchitectureKey) error
- type Shortcut
- type StartedDownload
- type Uninstaller
Constants ¶
const ( DetailFieldBin = "bin" DetailFieldShortcuts = "shortcuts" DetailFieldUrl = "url" DetailFieldHash = "hash" DetailFieldArchitecture = "architecture" DetailFieldDescription = "description" DetailFieldVersion = "version" DetailFieldNotes = "notes" DetailFieldDepends = "depends" DetailFieldEnvSet = "env_set" DetailFieldEnvAddPath = "env_add_path" DetailFieldPersist = "persist" DetailFieldExtractDir = "extract_dir" DetailFieldExtractTo = "extract_to" DetailFieldPostInstall = "post_install" DetailFieldPreInstall = "pre_install" DetailFieldPreUninstall = "pre_uninstall" DetailFieldPostUninstall = "post_uninstall" DetailFieldInstaller = "installer" DetailFieldUninstaller = "uninstaller" DetailFieldInnoSetup = "innosetup" )
Variables ¶
var ( ErrAlreadyInstalled = errors.New("app already installed (same version)") ErrAppNotFound = errors.New("app not found") ErrAppNotAvailableInVersion = errors.New("app not available in desird version") )
var DetailFieldsAll = []string{ DetailFieldBin, DetailFieldShortcuts, DetailFieldUrl, DetailFieldHash, DetailFieldArchitecture, DetailFieldDescription, DetailFieldVersion, DetailFieldNotes, DetailFieldDepends, DetailFieldEnvSet, DetailFieldEnvAddPath, DetailFieldPersist, DetailFieldExtractDir, DetailFieldExtractTo, DetailFieldPostInstall, DetailFieldPreInstall, DetailFieldPreUninstall, DetailFieldPostUninstall, DetailFieldInstaller, DetailFieldUninstaller, DetailFieldInnoSetup, }
DetailFieldsAll is a list of all available DetailFields to load during App.LoadDetails. Use these if you need all fields or don't care whether unneeded fields are being loaded.
var ErrBucketNoGitDir = errors.New(".git dir at path not found")
var ErrBucketNotFound = errors.New("bucket not found")
Functions ¶
func CachePath ¶
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
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 []Shortcut `json:"shortcuts"` EnvAddPath []string `json:"env_add_path"` EnvSet []EnvVar `json:"env_set"` Persist []PersistDir `json:"persist"` Downloadables []Downloadable `json:"downloadables"` Depends []Dependency `json:"depends"` Architecture map[ArchitectureKey]*Architecture `json:"architecture"` InnoSetup bool `json:"innosetup"` // Installer deprecates msi Installer *Installer `json:"installer"` Uninstaller *Uninstaller `json:"uninstaller"` PreInstall []string `json:"pre_install"` PostInstall []string `json:"post_install"` PreUninstall []string `json:"pre_uninstall"` PostUninstall []string `json:"post_uninstall"` ExtractTo []string `json:"extract_to"` 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.
Note that this structure doesn't reflect the same schema as the scoop manifests, as we are trying to make usage easier, not just as hard.
func (*App) AvailableVersions ¶ added in v0.0.3
func (*App) AvailableVersionsN ¶ added in v0.0.4
func (*App) ForArch ¶ added in v0.0.4
func (a *App) ForArch(arch ArchitectureKey) *AppResolved
ForArch will create a merged version that includes all the relevant fields at root level. Access to architecture shouldn't be required anymore, it should be ready to use for installtion, update or uninstall.
func (*App) LoadDetails ¶
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
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.ReadSeeker, 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 ¶
type AppResolved ¶ added in v0.0.4
type AppResolved struct { *App Bin []Bin `json:"bin"` Shortcuts []Shortcut `json:"shortcuts"` Downloadables []Downloadable `json:"downloadables"` // Installer deprecates msi; InnoSetup bool should be same for each // architecture. The docs don't mention it. Installer *Installer `json:"installer"` PreInstall []string `json:"pre_install"` PostInstall []string `json:"post_install"` }
AppResolved is a version of app forming the data into a way that it's ready for installation, deinstallation or update.
func (*AppResolved) Download ¶ added in v0.0.4
func (resolvedApp *AppResolved) Download( cacheDir string, arch ArchitectureKey, verifyHashes, overwriteCache bool, ) (chan any, error)
Download will download all files for the desired architecture, skipping already cached files. The cache lookups happen before downloading and are synchronous, directly returning an error instead of using the error channel. As soon as download starts (chan, chan, nil) is returned. Both channels are closed upon completion (success / failure). FIXME Make single result chan with a types: (download_start, download_finished, cache_hit)
type Architecture ¶ added in v0.0.3
type Architecture struct { Downloadables []Downloadable `json:"items"` Bin []Bin Shortcuts []Shortcut // Installer replaces MSI Installer *Installer Uninstaller *Uninstaller // 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 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 Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) AvailableApps ¶
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 ¶
Dir is the bucket directory, which contains the subdirectory "bucket" with the manifests.
func (*Bucket) ManifestDir ¶
ManifestDir is the directory path of the bucket without a leading slash.
type CacheHit ¶ added in v0.0.4
type CacheHit struct {
Downloadable *Downloadable
}
type ChecksumMismatchError ¶ added in v0.0.4
func (*ChecksumMismatchError) Error ¶ added in v0.0.4
func (err *ChecksumMismatchError) Error() string
type Dependencies ¶ added in v0.0.3
type Dependencies struct { App *App Values []*Dependencies }
type Dependency ¶ added in v0.0.3
type Downloadable ¶ added in v0.0.4
type FinishedDownload ¶ added in v0.0.4
type FinishedDownload struct {
Downloadable *Downloadable
}
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 // Archictecture defines which architecture was used for installation. On a // 64Bit system for example, this could also be 32Bit, but not vice versa. Architecture ArchitectureKey }
type KnownBucket ¶ added in v0.0.4
type OutdatedApp ¶ added in v0.0.3
type OutdatedApp struct { *InstalledApp ManifestDeleted bool LatestVersion string }
type PersistDir ¶ added in v0.0.7
type PersistDir struct { Dir string // LinkName is optional and can be used to rename the [Dir]. LinkName string }
PersistDir represents a directory in the installation of the application, which the app or the user will write to. This is placed in a separate location and kept upon uninstallation.
type Scoop ¶ added in v0.0.3
type Scoop struct {
// contains filtered or unexported fields
}
func NewCustomScoop ¶ added in v0.0.3
func (*Scoop) CreateShim ¶ added in v0.0.4
func (*Scoop) DependencyTree ¶ added in v0.0.3
func (scoop *Scoop) DependencyTree(a *App) (*Dependencies, error)
func (*Scoop) FindAvailableApp ¶ added in v0.0.4
func (*Scoop) FindInstalledApp ¶ added in v0.0.4
func (scoop *Scoop) FindInstalledApp(name string) (*InstalledApp, error)
func (*Scoop) GetBucket ¶ added in v0.0.3
GetBucket constructs a new bucket object pointing at the given bucket. At this point, the bucket might not necessarily exist.
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
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) Install ¶ added in v0.0.3
func (scoop *Scoop) Install(appName string, arch ArchitectureKey) error
func (*Scoop) InstallAll ¶ added in v0.0.4
func (scoop *Scoop) InstallAll(appNames []string, arch ArchitectureKey) []error
InstallAll will install the given application into userspace. If an app is already installed, it will be updated if applicable.
One key difference to scoop however, is how installing a concrete version works. Instead of creating a dirty manifest, we will search for the old manifest, install it and hold the app. This will have the same effect for the user, but without the fact that the user will never again get update notifications.
func (*Scoop) InstalledApps ¶ added in v0.0.4
func (scoop *Scoop) InstalledApps() ([]*InstalledApp, error)
func (*Scoop) LookupCache ¶ added in v0.0.3
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) PersistDir ¶ added in v0.0.4
func (*Scoop) RemoveShims ¶ added in v0.0.4
func (*Scoop) ReverseDependencyTree ¶ added in v0.0.3
func (scoop *Scoop) ReverseDependencyTree(apps []*App, app *App) *Dependencies
func (*Scoop) ScoopInstallationDir ¶ added in v0.0.4
func (Scoop) ShortcutDir ¶ added in v0.0.7
func (*Scoop) Uninstall ¶ added in v0.0.4
func (scoop *Scoop) Uninstall(app *InstalledApp, arch ArchitectureKey) error
type StartedDownload ¶ added in v0.0.4
type StartedDownload struct {
Downloadable *Downloadable
}
type Uninstaller ¶ added in v0.0.4
type Uninstaller Installer