Documentation
¶
Index ¶
- Constants
- func APICacheFilePath(cacheDir, rawURL string) string
- func CacheFilePath(cacheDir, url string) string
- func CacheFilePathWithMeta(cacheDir, url string, meta CacheMeta) string
- func Cast[T any](value any) (T, error)
- func ClientOptions(opts Options) client.Options
- func DetectGUIInstallMode(isGUI bool, fileName string) string
- func Download(url string, out io.Writer, getbar func(size int64) io.Writer, opts Options) error
- func DownloadFile(url, target string, getbar func(size int64) io.Writer, opts Options) (client.DownloadFileResult, error)
- func Get(url string, disableSSL bool) (*http.Response, error)
- func GetWithOptions(url string, opts Options) (*http.Response, error)
- func IsGitHubURL(s string) bool
- func IsLocalFile(s string) bool
- func IsURL(s string) bool
- func NewDownloadProgress(out io.Writer, size int64) *progress.Progress
- func NormalizeRepoTarget(target string) (string, error)
- func ProbeLastModified(url string, opts Options) string
- func SelectExtractorAs[T any](s *Service, url, tool string, opts *Options) (T, error)
- func SetAPICacheNoticeWriter(writer io.Writer) io.Writer
- func SetProxyNoticeWriter(writer io.Writer) io.Writer
- func SetVerbose(enabled bool, writer io.Writer)
- func TargetKindDisplayName(kind TargetKind) string
- func VerboseEnabledForTest() bool
- type Archive
- type ArchiveExtractOptions
- type ArchiveExtractor
- func (a *ArchiveExtractor) Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
- func (a *ArchiveExtractor) ExtractAllTo(data []byte, output string) ([]string, error)
- func (a *ArchiveExtractor) ExtractAllToWithOptions(data []byte, output string, opts ArchiveExtractOptions) ([]string, error)
- type ArchiveFn
- type BinaryChooser
- type CacheMeta
- type Chooser
- type ConfirmFunc
- type DecompFn
- type DefaultInstallerLauncher
- type Detector
- type DirectAllExtractor
- type DirectAssetFinder
- type ExtractedFile
- type Extractor
- type File
- type FileType
- type FilterChooser
- type Finder
- type GlobChooser
- type HTTPGetterFunc
- type InstallRunner
- type InstallerKind
- type InstallerLauncher
- type LiteralFileChooser
- type MultiChooser
- type Options
- type PromptFunc
- type RateLimit
- type RunResult
- type Runner
- type Service
- func (s *Service) SelectDetector(opts *Options) (Detector, error)
- func (s *Service) SelectExtractor(url, tool string, opts *Options) (any, error)
- func (s *Service) SelectFinder(target string, opts *Options) (Finder, string, error)
- func (s *Service) SelectVerifier(sumAsset string, opts *Options) (Verifier, error)
- type SevenZipArchive
- type SingleFileExtractor
- type System7zExtractor
- func (e *System7zExtractor) Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
- func (e *System7zExtractor) ExtractAllTo(data []byte, output string) ([]string, error)
- func (e *System7zExtractor) ExtractAllToWithOptions(data []byte, output string, opts ArchiveExtractOptions) ([]string, error)
- type TarArchive
- type TargetKind
- type URLTemplateOptions
- type Verifier
- type VersionFallbackFinder
- type ZipArchive
Constants ¶
View Source
const ( InstallModePortable = "portable" InstallModeInstaller = "installer" InstallModeRunAsset = "run-asset" InstallActionRunAsset = "run-asset" )
Variables ¶
This section is empty.
Functions ¶
func APICacheFilePath ¶ added in v1.5.1
func CacheFilePath ¶
func CacheFilePathWithMeta ¶ added in v1.6.0
func ClientOptions ¶ added in v1.5.2
func DetectGUIInstallMode ¶ added in v1.5.2
func DownloadFile ¶ added in v1.7.0
func IsGitHubURL ¶
func IsLocalFile ¶
func NewDownloadProgress ¶ added in v1.7.1
func NormalizeRepoTarget ¶
func ProbeLastModified ¶ added in v1.7.2
func SelectExtractorAs ¶
func SetAPICacheNoticeWriter ¶ added in v1.6.1
func SetVerbose ¶
func TargetKindDisplayName ¶ added in v1.7.2
func TargetKindDisplayName(kind TargetKind) string
func VerboseEnabledForTest ¶
func VerboseEnabledForTest() bool
Types ¶
type Archive ¶
func NewSevenZipArchive ¶ added in v1.5.1
type ArchiveExtractOptions ¶ added in v1.7.0
type ArchiveExtractOptions struct {
StripComponents int
}
type ArchiveExtractor ¶
func NewArchiveExtractor ¶
func NewArchiveExtractor(file Chooser, ar ArchiveFn, decompress DecompFn) *ArchiveExtractor
func (*ArchiveExtractor) Extract ¶
func (a *ArchiveExtractor) Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
func (*ArchiveExtractor) ExtractAllTo ¶ added in v1.6.1
func (a *ArchiveExtractor) ExtractAllTo(data []byte, output string) ([]string, error)
func (*ArchiveExtractor) ExtractAllToWithOptions ¶ added in v1.7.0
func (a *ArchiveExtractor) ExtractAllToWithOptions(data []byte, output string, opts ArchiveExtractOptions) ([]string, error)
type BinaryChooser ¶
type BinaryChooser struct {
Tool string
}
func NewBinaryChooser ¶
func NewBinaryChooser(tool string) *BinaryChooser
func (*BinaryChooser) String ¶
func (b *BinaryChooser) String() string
type Chooser ¶
type Chooser interface {
Choose(name string, dir bool, mode fs.FileMode) (direct bool, possible bool)
}
func NewFileChooser ¶ added in v1.5.1
type ConfirmFunc ¶ added in v1.5.2
type DefaultInstallerLauncher ¶ added in v1.5.2
type DefaultInstallerLauncher struct {
GOOS string
}
func (DefaultInstallerLauncher) LaunchInstaller ¶ added in v1.5.2
func (l DefaultInstallerLauncher) LaunchInstaller(path string, kind InstallerKind) error
type DirectAllExtractor ¶ added in v1.6.1
type DirectAssetFinder ¶
type DirectAssetFinder struct {
URL string
}
func (*DirectAssetFinder) Find ¶
func (f *DirectAssetFinder) Find() ([]string, error)
type ExtractedFile ¶
type ExtractedFile struct {
Name string
ArchiveName string
Extract func(to string) error
Dir bool
// contains filtered or unexported fields
}
func (ExtractedFile) Mode ¶
func (e ExtractedFile) Mode() fs.FileMode
func (ExtractedFile) String ¶
func (e ExtractedFile) String() string
type Extractor ¶
type Extractor interface {
Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
}
type FilterChooser ¶ added in v1.7.2
type FilterChooser struct {
// contains filtered or unexported fields
}
func (*FilterChooser) String ¶ added in v1.7.2
func (f *FilterChooser) String() string
type GlobChooser ¶
type GlobChooser struct {
// contains filtered or unexported fields
}
func NewGlobChooser ¶
func NewGlobChooser(gl string) (*GlobChooser, error)
func (*GlobChooser) String ¶
func (g *GlobChooser) String() string
type HTTPGetterFunc ¶
func NewHTTPGetter ¶
func NewHTTPGetter(opts Options) HTTPGetterFunc
type InstallRunner ¶
type InstallRunner struct {
Service *Service
InstalledLoad func() (map[string]string, map[string]string, error)
Prompt PromptFunc
ConfirmLaunchInstaller ConfirmFunc
InstallerLauncher InstallerLauncher
AssetRunner func(path string, args []string, stdout, stderr io.Writer) error
Stdout io.Writer
Stderr io.Writer
}
func NewRunner ¶
func NewRunner(service *Service) *InstallRunner
type InstallerKind ¶ added in v1.5.2
type InstallerKind string
const ( InstallerKindUnknown InstallerKind = "" InstallerKindMSI InstallerKind = "msi" InstallerKindEXE InstallerKind = "exe" )
func DetectInstallerKind ¶ added in v1.5.2
func DetectInstallerKind(fileName string) InstallerKind
type InstallerLauncher ¶ added in v1.5.2
type InstallerLauncher interface {
LaunchInstaller(path string, kind InstallerKind) error
}
type LiteralFileChooser ¶
type LiteralFileChooser struct {
File string
}
func (*LiteralFileChooser) String ¶
func (l *LiteralFileChooser) String() string
type MultiChooser ¶ added in v1.5.1
type MultiChooser struct {
// contains filtered or unexported fields
}
func (*MultiChooser) String ¶ added in v1.5.1
func (m *MultiChooser) String() string
type Options ¶
type Options struct {
Tag string
Prerelease bool
Name string
Verbose bool
Source bool
SourcePath string
Sys7zPath string
Output string
OutputExplicit bool
GuiTarget string
IsGUI bool
InstallMode string
CacheDir string
CacheName string
CacheVersion string
ProxyURL string
UserAgent string
APICacheEnabled bool
APICacheDir string
APICacheTime int
GhproxyEnabled bool
GhproxyHostURL string
GhproxySupportAPI bool
GhproxyFallbacks []string
System string
ExtractFile string
All bool
StripComponents int
Quiet bool
DownloadOnly bool
FallbackVersions int
ChunkConcurrency int
BatchConcurrency int
ChunkConcurrencySet bool
BatchConcurrencySet bool
UpgradeOnly bool
Asset []string
RenameFiles map[string]string
Hash bool
Verify string
URLTemplate URLTemplateOptions
DisableSSL bool
}
type RateLimit ¶
func GetRateLimit ¶
type Service ¶
type Service struct {
BinaryModTime func(tool, output string) time.Time
GitHubGetter sourcegithub.HTTPGetter
GitHubGetterFactory func(opts Options) sourcegithub.HTTPGetter
ForgeGetterFactory func(opts Options) forge.HTTPGetter
SourceForgeGetterFactory func(opts Options) sourcesf.HTTPGetter
TemplateGetterFactory func(opts Options) urltemplate.HTTPGetter
AllDetectorFactory func() Detector
SystemDetectorFactory func(goos, goarch string) (Detector, error)
AssetDetectorFactory func(asset string, anti bool, re *regexp.Regexp) Detector
DetectorChainFactory func(detectors []Detector, system Detector) Detector
Sha256VerifierFactory func(expected string) (Verifier, error)
Sha256AssetVerifierFactory func(assetURL string, opts Options) Verifier
Sha256PrinterFactory func() Verifier
NoVerifierFactory func() Verifier
DownloadOnlyExtractorFactory func(name string) any
GlobChooserFactory func(pattern string) (any, error)
BinaryChooserFactory func(tool string) any
ExtractorFactory func(filename, tool string, chooser any) any
System7zPathResolver func(configured string) string
System7zExtractorFactory func(filename, tool string, chooser Chooser, exe string) Extractor
}
func NewDefaultService ¶
func NewDefaultService(githubGetter sourcegithub.HTTPGetter, binaryModTime func(tool, output string) time.Time) *Service
func NewService ¶
func NewService() *Service
func (*Service) SelectExtractor ¶
func (*Service) SelectFinder ¶
type SevenZipArchive ¶ added in v1.5.1
type SevenZipArchive struct {
// contains filtered or unexported fields
}
func (*SevenZipArchive) Next ¶ added in v1.5.1
func (z *SevenZipArchive) Next() (File, error)
func (*SevenZipArchive) ReadAll ¶ added in v1.5.1
func (z *SevenZipArchive) ReadAll() ([]byte, error)
type SingleFileExtractor ¶
type SingleFileExtractor struct {
Rename string
Name string
Decompress func(r io.Reader) (io.Reader, error)
}
func NewDownloadOnlyExtractor ¶
func NewDownloadOnlyExtractor(name string) *SingleFileExtractor
func (*SingleFileExtractor) Extract ¶
func (s *SingleFileExtractor) Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
type System7zExtractor ¶ added in v1.6.1
func NewSystem7zExtractor ¶ added in v1.6.1
func NewSystem7zExtractor(filename, tool string, chooser Chooser, exe string) *System7zExtractor
func (*System7zExtractor) Extract ¶ added in v1.6.1
func (e *System7zExtractor) Extract(data []byte, multiple bool) (ExtractedFile, []ExtractedFile, error)
func (*System7zExtractor) ExtractAllTo ¶ added in v1.6.1
func (e *System7zExtractor) ExtractAllTo(data []byte, output string) ([]string, error)
func (*System7zExtractor) ExtractAllToWithOptions ¶ added in v1.7.0
func (e *System7zExtractor) ExtractAllToWithOptions(data []byte, output string, opts ArchiveExtractOptions) ([]string, error)
type TarArchive ¶
type TarArchive struct {
// contains filtered or unexported fields
}
func (*TarArchive) Next ¶
func (t *TarArchive) Next() (File, error)
func (*TarArchive) ReadAll ¶
func (t *TarArchive) ReadAll() ([]byte, error)
type TargetKind ¶
type TargetKind string
const ( TargetUnknown TargetKind = "unknown" TargetRepo TargetKind = "repo" TargetGitHubURL TargetKind = "github_url" TargetDirectURL TargetKind = "direct_url" TargetLocalFile TargetKind = "local_file" TargetSourceForge TargetKind = "sourceforge" TargetForge TargetKind = "forge" TargetTemplate TargetKind = "template" )
func DetectTargetKind ¶
func DetectTargetKind(target string) TargetKind
type URLTemplateOptions ¶ added in v1.7.0
type URLTemplateOptions struct {
URLTemplate string
LatestURL string
LatestFormat string
LatestJSONPath string
VersionRegex string
OSMap map[string]string
ArchMap map[string]string
ExtMap map[string]string
LibcMap map[string]string
ChecksumURLTemplate string
ChecksumFormat string
ChecksumJSONPath string
ChecksumRegex string
InstallAction string
InstallArgs []string
ResolvedVersion string
ResolvedVars map[string]string
}
type VersionFallbackFinder ¶ added in v1.5.5
type ZipArchive ¶
type ZipArchive struct {
// contains filtered or unexported fields
}
func (*ZipArchive) Next ¶
func (z *ZipArchive) Next() (File, error)
func (*ZipArchive) ReadAll ¶
func (z *ZipArchive) ReadAll() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.