configurator

package
v12.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PenaltyExclude = iota
	PenaltyScore
)

Variables

This section is empty.

Functions

func HasExt

func HasExt(path string, ext string) bool

func PathDepth

func PathDepth(path string) int

Types

type Arch

type Arch string

The architecture of an executable

const (
	// 32-bit
	Arch386 Arch = "386"
	// 64-bit
	ArchAmd64 Arch = "amd64"
)

type BiggestFirst

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

func (*BiggestFirst) Len

func (bf *BiggestFirst) Len() int

func (*BiggestFirst) Less

func (bf *BiggestFirst) Less(i, j int) bool

func (*BiggestFirst) Swap

func (bf *BiggestFirst) Swap(i, j int)

type BlacklistEntry

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

type Candidate

type Candidate struct {
	// Path is relative to the configured folder
	Path string `json:"path"`
	// Mode describes file permissions
	Mode uint32 `json:"mode,omitempty"`
	// Depth is the number of path elements leading up to this candidate
	Depth int `json:"depth"`
	// Flavor is the type of a candidate - native, html, jar etc.
	Flavor Flavor `json:"flavor"`
	// Arch describes the architecture of a candidate (where relevant)
	Arch Arch `json:"arch,omitempty"`
	// Size is the size of the candidate's file, in bytes
	Size int64 `json:"size"`
	// Spell contains raw output from <https://github.com/fasterthanlime/wizardry>
	// @optional
	Spell []string `json:"spell,omitempty"`
	// WindowsInfo contains information specific to native Windows candidates
	// @optional
	WindowsInfo *WindowsInfo `json:"windowsInfo,omitempty"`
	// LinuxInfo contains information specific to native Linux candidates
	// @optional
	LinuxInfo *LinuxInfo `json:"linuxInfo,omitempty"`
	// MacosInfo contains information specific to native macOS candidates
	// @optional
	MacosInfo *MacosInfo `json:"macosInfo,omitempty"`
	// LoveInfo contains information specific to Love2D bundles (`.love` files)
	// @optional
	LoveInfo *LoveInfo `json:"loveInfo,omitempty"`
	// ScriptInfo contains information specific to shell scripts (`.sh`, `.bat` etc.)
	// @optional
	ScriptInfo *ScriptInfo `json:"scriptInfo,omitempty"`
	// JarInfo contains information specific to Java archives (`.jar` files)
	// @optional
	JarInfo *JarInfo `json:"jarInfo,omitempty"`
}

A Candidate is a potentially interesting launch target, be it a native executable, a Java or Love2D bundle, an HTML index, etc.

func SelectByArch

func SelectByArch(candidates []*Candidate, a Arch) []*Candidate

func SelectByFlavor

func SelectByFlavor(candidates []*Candidate, f Flavor) []*Candidate

func SelectByFunc

func SelectByFunc(candidates []*Candidate, f CandidateFilter) []*Candidate

func Sniff

func Sniff(r io.ReadSeeker, path string, size int64) (*Candidate, error)

func (*Candidate) String

func (c *Candidate) String() string

type CandidateFilter

type CandidateFilter func(candidate *Candidate) bool

type Flavor

type Flavor string

Flavor describes whether we're dealing with a native executables, a Java archive, a love2d bundle, etc.

const (
	// FlavorNativeLinux denotes native linux executables
	FlavorNativeLinux Flavor = "linux"
	// ExecNativeMacos denotes native macOS executables
	FlavorNativeMacos Flavor = "macos"
	// FlavorPe denotes native windows executables
	FlavorNativeWindows Flavor = "windows"
	// FlavorAppMacos denotes a macOS app bundle
	FlavorAppMacos Flavor = "app-macos"
	// FlavorScript denotes scripts starting with a shebang (#!)
	FlavorScript Flavor = "script"
	// FlavorScriptWindows denotes windows scripts (.bat or .cmd)
	FlavorScriptWindows Flavor = "windows-script"
	// FlavorJar denotes a .jar archive with a Main-Class
	FlavorJar Flavor = "jar"
	// FlavorHTML denotes an index html file
	FlavorHTML Flavor = "html"
	// FlavorLove denotes a love package
	FlavorLove Flavor = "love"
)

type HighestScoreFirst

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

func (*HighestScoreFirst) Len

func (hsf *HighestScoreFirst) Len() int

func (*HighestScoreFirst) Less

func (hsf *HighestScoreFirst) Less(i, j int) bool

func (*HighestScoreFirst) Swap

func (hsf *HighestScoreFirst) Swap(i, j int)

type JarInfo

type JarInfo struct {
	// The main Java class as specified by the manifest included in the .jar (if any)
	// @optional
	MainClass string `json:"mainClass,omitempty"`
}

Contains information specific to Java archives

type LinuxInfo

type LinuxInfo struct {
}

Contains information specific to native Linux executables

type LoveInfo

type LoveInfo struct {
	// The version of love2D required to open this bundle. May be empty
	// @optional
	Version string `json:"version,omitempty"`
}

Contains information specific to Love2D bundles

type MacosInfo

type MacosInfo struct {
}

Contains information specific to native macOS executables or app bundles.

type Penalty

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

type PenaltyKind

type PenaltyKind int

type ScoredCandidate

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

type ScriptInfo

type ScriptInfo struct {
	// Something like `/bin/bash`
	// @optional
	Interpreter string `json:"interpreter,omitempty"`
}

Contains information specific to shell scripts

type Verdict

type Verdict struct {
	// BasePath is the absolute path of the folder that was configured
	BasePath string `json:"basePath"`
	// TotalSize is the size in bytes of the folder and all its children, recursively
	TotalSize int64 `json:"totalSize"`
	// Candidates is a list of potentially interesting files, with a lot of additional info
	Candidates []*Candidate `json:"candidates"`
}

A Verdict contains a wealth of information on how to "launch" or "open" a specific folder.

func Configure

func Configure(root string, showSpell bool) (*Verdict, error)

func (*Verdict) FilterPlatform

func (v *Verdict) FilterPlatform(osFilter string, archFilter string)

func (*Verdict) FixPermissions

func (v *Verdict) FixPermissions(dryrun bool) ([]string, error)

func (*Verdict) String

func (v *Verdict) String() string

type WindowsInfo

type WindowsInfo struct {
	// Particular type of installer (msi, inno, etc.)
	// @optional
	InstallerType WindowsInstallerType `json:"installerType,omitempty"`
	// True if we suspect this might be an uninstaller rather than an installer
	// @optional
	Uninstaller bool `json:"uninstaller,omitempty"`
	// Is this executable marked as GUI? This can be false and still pop a GUI, it's just a hint.
	// @optional
	Gui bool `json:"gui,omitempty"`
	// Is this a .NET assembly?
	// @optional
	DotNet bool `json:"dotNet,omitempty"`
}

Contains information specific to native windows executables or installer packages.

type WindowsInstallerType

type WindowsInstallerType string

Which particular type of windows-specific installer

const (
	// Microsoft install packages (`.msi` files)
	WindowsInstallerTypeMsi WindowsInstallerType = "msi"
	// InnoSetup installers
	WindowsInstallerTypeInno WindowsInstallerType = "inno"
	// NSIS installers
	WindowsInstallerTypeNullsoft WindowsInstallerType = "nsis"
	// Self-extracting installers that 7-zip knows how to extract
	WindowsInstallerTypeArchive WindowsInstallerType = "archive"
)

Jump to

Keyboard shortcuts

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