Documentation
¶
Index ¶
- Variables
- func APICacheFilePath(cacheDir, rawURL string) string
- func CacheFilePath(cacheDir, url string) string
- func Cast[T any](value any) (T, error)
- func Download(url string, out io.Writer, getbar func(size int64) *pb.ProgressBar, ...) 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 NormalizeRepoTarget(target string) (string, error)
- func SelectExtractorAs[T any](s *Service, url, tool string, opts *Options) (T, error)
- func SetVerbose(enabled bool, writer io.Writer)
- func VerboseEnabledForTest() bool
- type Archive
- type ArchiveExtractor
- type ArchiveFn
- type BinaryChooser
- type Chooser
- type DecompFn
- type Detector
- type DirectAssetFinder
- type ExtractedFile
- type Extractor
- type File
- type FileType
- type Finder
- type GlobChooser
- type HTTPGetterFunc
- type InstallRunner
- type LiteralFileChooser
- type MultiChooser
- type Options
- type PromptFunc
- type RateLimit
- type RateLimitJSON
- 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 TarArchive
- type TargetKind
- type Verifier
- type ZipArchive
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoToken = errors.New("no github token")
Functions ¶
func APICacheFilePath ¶ added in v1.5.1
func CacheFilePath ¶
func IsGitHubURL ¶
func IsLocalFile ¶
func NormalizeRepoTarget ¶
func SelectExtractorAs ¶
func SetVerbose ¶
func VerboseEnabledForTest ¶
func VerboseEnabledForTest() bool
Types ¶
type Archive ¶
func NewSevenZipArchive ¶ added in v1.5.1
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)
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 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 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
Stdout io.Writer
Stderr io.Writer
}
func NewRunner ¶
func NewRunner(service *Service) *InstallRunner
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
Output string
CacheDir string
ProxyURL string
APICacheEnabled bool
APICacheDir string
APICacheTime int
GhproxyEnabled bool
GhproxyHostURL string
GhproxySupportAPI bool
GhproxyFallbacks []string
System string
ExtractFile string
All bool
Quiet bool
DownloadOnly bool
UpgradeOnly bool
Asset []string
Hash bool
Verify string
DisableSSL bool
}
type PromptFunc ¶
type RateLimit ¶
type RateLimit struct {
Limit int `json:"limit"`
Remaining int `json:"remaining"`
Reset int64 `json:"reset"`
}
func GetRateLimit ¶
type RateLimitJSON ¶
type Service ¶
type Service struct {
BinaryModTime func(tool, output string) time.Time
GitHubGetter sourcegithub.HTTPGetter
GitHubGetterFactory func(opts Options) sourcegithub.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
}
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 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" )
func DetectTargetKind ¶
func DetectTargetKind(target string) TargetKind
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.