repository

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package repository provides types and operations for managing GitHub releases.

Index

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.

func NewAsset

func NewAsset(execName string) *Asset

NewAsset creates a new Asset instance.

func (*Asset) ExecPath

func (a *Asset) ExecPath(cachePath string) string

ExecPath returns the path of the executable file for this asset.

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.

Jump to

Keyboard shortcuts

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