repository

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package repository provides types and operations for managing GitHub releases.

Index

Constants

This section is empty.

Variables

View Source
var ValidEditions = []string{"standard", "withdeploy", "extended", "extended_withdeploy"}

ValidEditions is the canonical ordered list of Hugo edition names.

Functions

func SelectEdition added in v0.14.0

func SelectEdition(a *Asset, msg string, editions []string) error

SelectEdition prompts the user to select an edition from the given ordered list. On return, a.Edition is set to the chosen edition, or empty if cancelled.

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
	Edition         string // Edition of the release asset (e.g. standard, extended)
	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.

func (*Asset) SetURLFromEditions added in v0.14.0

func (a *Asset) SetURLFromEditions(editions map[string]string) error

SetURLFromEditions sets ArchiveURL and ArchiveExt on the asset from the editions map using the already-set Edition field. Returns an error if the edition is not present in the map.

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, cacheDirPath string) (*Repository, error)

NewRepository creates a new Repository instance and fetches releases. cacheDirPath is the local hvm cache directory used to persist the release list between invocations. Pass an empty string to disable caching.

func (*Repository) FetchEditions added in v0.14.0

func (r *Repository) FetchEditions(a *Asset) (map[string]string, error)

FetchEditions fetches all available edition download URLs for the asset's tag on the current OS and architecture. The returned map is keyed by edition name (e.g. "standard", "extended", "extended_withdeploy", "withdeploy").

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) SelectTag

func (r *Repository) SelectTag(a *Asset, msg string, sortAscending bool, numTagsToDisplay int) error

SelectTag prompts the user to select a tag from a list of recent tags. sortAscending determines the sort order, numTagsToDisplay limits the count.

func (*Repository) SetTagsForTesting

func (r *Repository) SetTagsForTesting(tags []string, latestTag string)

SetTagsForTesting sets tags and latestTag directly. For use in tests only.

Jump to

Keyboard shortcuts

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