Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ArchAMD64 = Arch{ // contains filtered or unexported fields } ArchI386 = Arch{ // contains filtered or unexported fields } ArchArm = Arch{ // contains filtered or unexported fields } ArchArm64 = Arch{ // contains filtered or unexported fields } ArchRiscv64 = Arch{ // contains filtered or unexported fields } )
var ( OSDarwin = OS{ Name: "darwin", Regex: regexp.MustCompile(`(?i)(darwin|mac.?(os)?|osx)`), } OSWindows = OS{ Name: "windows", Regex: regexp.MustCompile(`(?i)([^r]win|windows)`), } OSLinux = OS{ Name: "linux", Regex: regexp.MustCompile(`(?i)(linux|ubuntu)`), Anti: regexp.MustCompile(`(?i)(android)`), Priority: regexp.MustCompile(`\.appimage$`), } OSNetBSD = OS{ Name: "netbsd", Regex: regexp.MustCompile(`(?i)(netbsd)`), } OSFreeBSD = OS{ Name: "freebsd", Regex: regexp.MustCompile(`(?i)(freebsd)`), } OSOpenBSD = OS{ Name: "openbsd", Regex: regexp.MustCompile(`(?i)(openbsd)`), } OSAndroid = OS{ Name: "android", Regex: regexp.MustCompile(`(?i)(android)`), } OSIllumos = OS{ Name: "illumos", Regex: regexp.MustCompile(`(?i)(illumos)`), } OSSolaris = OS{ Name: "solaris", Regex: regexp.MustCompile(`(?i)(solaris)`), } OSPlan9 = OS{ Name: "plan9", Regex: regexp.MustCompile(`(?i)(plan9)`), } )
Functions ¶
This section is empty.
Types ¶
type AllDetector ¶
type AllDetector struct{}
AllDetector matches every asset. If there is only one asset, it is returned as a direct match. If there are multiple assets they are all returned as candidates.
func (*AllDetector) Detect ¶
func (a *AllDetector) Detect(assets []Asset) (DetectionResult, error)
type Arch ¶
type Arch struct {
// contains filtered or unexported fields
}
An Arch represents a system architecture, such as amd64, i386, arm or others.
type DetectionResult ¶
func NewDetectionResult ¶
func NewDetectionResult(asset *assets.Asset, candidates []assets.Asset) DetectionResult
type Detector ¶
type Detector interface { // Detect takes a list of possible assets and returns a direct match. If a // single direct match is not found, it returns a list of candidates and an // error explaining what happened. Detect(assets []Asset) (DetectionResult, error) }
A Detector selects an asset from a list of possibilities.
func DetermineCorrectDetector ¶
func DetermineCorrectDetector(opts *appflags.Flags, system *SystemDetector) (detector Detector, err error)
Determine the appropriate detector. If the --system is 'all', we use an AllDetector, which will just return all assets. Otherwise we use the --system pair provided by the user, or the runtime.GOOS/runtime.GOARCH pair by default (the host system OS/Arch pair).
type DetectorChain ¶
func (*DetectorChain) Detect ¶
func (dc *DetectorChain) Detect(assets []Asset) (DetectionResult, error)
type OS ¶
type OS struct { Name string Regex *regexp.Regexp Anti *regexp.Regexp Priority *regexp.Regexp // matches to priority are better than normal matches }
An OS represents a target operating system.
type SingleAssetDetector ¶
SingleAssetDetector finds a single named asset. If Anti is true it finds all assets that don't contain Asset.
func (*SingleAssetDetector) Detect ¶
func (s *SingleAssetDetector) Detect(assets []Asset) (DetectionResult, error)
type SystemDetector ¶
A SystemDetector matches a particular OS/Arch system pair.
func NewSystemDetector ¶
func NewSystemDetector(sos, sarch string) (*SystemDetector, error)
NewSystemDetector returns a new detector for the given OS/Arch as given by Go OS/Arch names.
func (*SystemDetector) Detect ¶
func (d *SystemDetector) Detect(assets []Asset) (DetectionResult, error)
Detect extracts the assets that match this detector's OS/Arch pair. If one direct OS/Arch match is found, it is returned. If multiple OS/Arch matches are found they are returned as candidates. If multiple assets that only match the OS are found, and no full OS/Arch matches are found, the OS matches are returned as candidates. Otherwise all assets are returned as candidates.