app

package
v0.0.0-...-129ab4d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTargetGiven = errors.New("no target given")
View Source
var ErrNoToken = errors.New("no github token")
View Source
var ErrSuccess = errors.New("success")

Functions

func BuildConfigurationFilename

func BuildConfigurationFilename(paths ...string) string

func GetCacheFilename

func GetCacheFilename(v vfs.FS) string

func GetOSConfigPath

func GetOSConfigPath(homePath string) string

Types

type Application

type Application struct {
	Output  io.Writer
	Outputs *ApplicationOutputs
	Opts    Flags

	Args []string

	Config      *Config
	Cache       data.Cache
	Filesystem  vfs.FS
	Reference   *RepositoryReference
	Registry    *registry.LockFile
	Target      string
	TargetFound bool
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(outputs *ApplicationOutputs) *Application

func (*Application) DetectAssets

func (app *Application) DetectAssets(assetWrapper *AssetWrapper) (*detectors.DetectionResult, error)

func (*Application) Download

func (app *Application) Download(url string, out io.Writer) error

Download the file at 'url' and write the http response body to 'out'. The 'getbar' function allows the caller to construct a progress bar given the size of the file being downloaded, and the download will write to the returned progress bar.

func (*Application) DownloadAndVerify

func (app *Application) DownloadAndVerify(assetWrapper *AssetWrapper, findResult *finders.FindResult) ([]byte, *ReturnStatus)

func (*Application) DownloadClient

func (app *Application) DownloadClient() *download.Client

func (*Application) ExtractBins

func (app *Application) ExtractBins(bin ExtractedFile, bins []ExtractedFile, extractAll bool) int

func (*Application) ExtractDownloadedAsset

func (app *Application) ExtractDownloadedAsset(assetWrapper *AssetWrapper, body []byte, finder *finders.ValidFinder) (int, *ReturnStatus)

func (*Application) FilterDetectedAssets

func (app *Application) FilterDetectedAssets(detected *detectors.DetectionResult, findResult *finders.FindResult) *ReturnStatus

func (*Application) Find

func (*Application) ProcessCommands

func (app *Application) ProcessCommands(target string) string

func (*Application) ProcessFilters

func (app *Application) ProcessFilters(finder *finders.ValidFinder, findResult *finders.FindResult) *ReturnStatus

func (*Application) ProcessFlags

func (app *Application) ProcessFlags(errorHandler ProcessFlagsErrorHandlerFunc) (string, error)

func (*Application) RateLimitExceeded

func (app *Application) RateLimitExceeded() error

func (*Application) RefreshRateLimit

func (app *Application) RefreshRateLimit() error

func (*Application) Run

func (app *Application) Run() *ReturnStatus

func (*Application) RunSetup

func (*Application) SetGlobalOptionsFromConfig

func (app *Application) SetGlobalOptionsFromConfig() error

Move the loaded configuration file global options into the opts variable

func (*Application) SetProjectOptionsFromConfig

func (app *Application) SetProjectOptionsFromConfig(projectName string) error

Move the loaded configuration file project options into the opts variable

func (*Application) ToolName

func (app *Application) ToolName() string

func (*Application) VerifyChecksums

func (app *Application) VerifyChecksums(wrapper *AssetWrapper, body []byte) verifiers.VerifyChecksumResult

func (*Application) Write

func (app *Application) Write(format string, args ...any) (n int, err error)

func (*Application) WriteCheck

func (app *Application) WriteCheck(newLine bool)

func (*Application) WriteError

func (app *Application) WriteError(format string, args ...any)

func (*Application) WriteErrorLine

func (app *Application) WriteErrorLine(format string, args ...any)

func (*Application) WriteLine

func (app *Application) WriteLine(format string, args ...any) (n int, err error)

func (*Application) WriteVerbose

func (app *Application) WriteVerbose(format string, args ...any) (n int, err error)

func (*Application) WriteVerboseLine

func (app *Application) WriteVerboseLine(format string, args ...any) (n int, err error)

type ApplicationOutputs

type ApplicationOutputs struct {
	Stdout  io.Writer
	Stderr  io.Writer
	Discard io.Writer
}

func NewApplicationOutputs

func NewApplicationOutputs(stdout io.Writer, stderr io.Writer) *ApplicationOutputs

type Config

type Config struct {
	Meta struct {
		Keys     []string
		MetaData *toml.MetaData
	}
	Global       ConfigGlobal `toml:"global"`
	Repositories map[string]ConfigRepository
}

func LoadConfigurationFile

func LoadConfigurationFile(path string) (*Config, error)

type ConfigGlobal

type ConfigGlobal struct {
	All            bool     `toml:"all"`
	DownloadOnly   bool     `toml:"download_only"`
	File           string   `toml:"file"`
	GithubToken    string   `toml:"github_token"`
	Quiet          bool     `toml:"quiet"`
	ShowHash       bool     `toml:"show_hash"`
	Source         bool     `toml:"download_source"`
	System         string   `toml:"system"`
	Target         string   `toml:"target"`
	UpgradeOnly    bool     `toml:"upgrade_only"`
	RemoveExisting bool     `toml:"remove_existing"`
	IgnorePatterns []string `toml:"ignore_patterns"`
}

type ConfigRepository

type ConfigRepository struct {
	All            bool     `toml:"all"`
	AssetFilters   []string `toml:"asset_filters"`
	DownloadOnly   bool     `toml:"download_only"`
	File           string   `toml:"file"`
	Name           string   `toml:"name"`
	Quiet          bool     `toml:"quiet"`
	ShowHash       bool     `toml:"show_hash"`
	Source         bool     `toml:"download_source"`
	System         string   `toml:"system"`
	Tag            string   `toml:"tag"`
	Target         string   `toml:"target"`
	UpgradeOnly    bool     `toml:"upgrade_only"`
	Verify         string   `toml:"verify_sha256"`
	DisableSSL     bool     `toml:"disable_ssl"`
	RemoveExisting bool     `toml:"remove_existing"`
}

type ProcessFlagsErrorHandlerFunc

type ProcessFlagsErrorHandlerFunc = func(err error) error

type ReturnStatus

type ReturnStatus struct {
	Code ReturnStatusCode
	Err  error
	Msg  string
}

func NewReturnStatus

func NewReturnStatus(code ReturnStatusCode, err error, msg string) *ReturnStatus

type ReturnStatusCode

type ReturnStatusCode int
const (
	Success    ReturnStatusCode = iota
	Failure    ReturnStatusCode = -1
	FatalError ReturnStatusCode = -2
)

Jump to

Keyboard shortcuts

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