Documentation
¶
Overview ¶
Package repository provides types and operations for managing GitHub releases.
Index ¶
- type Asset
- type Repository
- func (r *Repository) FetchDownloadURL(a *Asset) error
- func (r *Repository) FetchTags() error
- func (r *Repository) GetLatestTag(a *Asset) error
- func (r *Repository) GetTagFromString(a *Asset, version string) error
- func (r *Repository) LatestTag() string
- func (r *Repository) SelectTag(a *Asset, msg string, sortAscending bool, numTagsToDisplay int, ...) error
- func (r *Repository) SetTagsForTesting(tags []string, latestTag string)
- func (r *Repository) Tags() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
ArchiveDirPath string // Directory path of the downloaded archive
ArchiveExt string // Extension of the downloaded archive: pkg, tar.gz, or zip
ArchiveFilePath string // File path of the downloaded archive
ArchiveURL string // Download URL for this asset
Tag string // User-selected tag associated with the release for this asset
ExecName string // Name of the executable file
}
Asset represents a GitHub release asset for a given release, OS, and architecture.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a GitHub repository.
func NewRepository ¶
func NewRepository(owner, name string, client *github.Client) (*Repository, error)
NewRepository creates a new Repository instance and fetches tags.
func (*Repository) FetchDownloadURL ¶
func (r *Repository) FetchDownloadURL(a *Asset) error
FetchDownloadURL fetches the download URL for the user-selected tag. cacheLookupFn is used to check if a cached version exists.
func (*Repository) FetchTags ¶
func (r *Repository) FetchTags() error
FetchTags fetches tags associated with recent releases.
func (*Repository) GetLatestTag ¶
func (r *Repository) GetLatestTag(a *Asset) error
GetLatestTag returns the most recent tag from the repository.
func (*Repository) GetTagFromString ¶
func (r *Repository) GetTagFromString(a *Asset, version string) error
GetTagFromString parses and validates a version string and sets it on the asset.
func (*Repository) LatestTag ¶
func (r *Repository) LatestTag() string
LatestTag returns the latest tag.
func (*Repository) SelectTag ¶
func (r *Repository) SelectTag(a *Asset, msg string, sortAscending bool, numTagsToDisplay int, excludeExistsFn func(string) (bool, error)) error
SelectTag prompts the user to select a tag from a list of recent tags. sortAscending determines the sort order, numTagsToDisplay limits the count. excludeExistsFn is used to check if a tag is already cached.
func (*Repository) SetTagsForTesting ¶
func (r *Repository) SetTagsForTesting(tags []string, latestTag string)
SetTagsForTesting allows tests to set tags directly. This is exported for testing purposes only.
func (*Repository) Tags ¶
func (r *Repository) Tags() []string
Tags returns the list of available tags.