registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package registry fetches and parses the CheatMD cheat-pack registry: a remote YAML manifest that lists installable cheat repositories ("packs").

The registry is hosted in its own repo (see the cheatmd.registry scaffold); the tool fetches it over HTTPS during first-run setup so users can pick official packs of cheats to install.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pack

type Pack struct {
	// Name is a short identifier, also used as the install subdirectory name.
	Name string `yaml:"name"`
	// Repo is the clonable repository URL (e.g. https://github.com/owner/repo).
	Repo string `yaml:"repo"`
	// Description is a one-line human summary shown in the picker.
	Description string `yaml:"description"`
	// Official marks packs as officially maintained, pre-selected during first-run.
	Official bool `yaml:"official"`
	// Subdir optionally restricts installation to .md files under this path
	// within the repo. Empty means the whole repo.
	Subdir string `yaml:"subdir"`
}

Pack describes a single installable cheat repository in the registry.

type Registry

type Registry struct {
	Version int    `yaml:"version"`
	Packs   []Pack `yaml:"packs"`
}

Registry is the parsed manifest.

func Fetch

func Fetch(ctx context.Context, url string) (*Registry, error)

Fetch retrieves and parses the registry manifest at url.

func Parse

func Parse(data []byte) (*Registry, error)

Parse unmarshals registry YAML and validates required fields. It is split from Fetch so it can be unit-tested without a network round-trip.

func (*Registry) OfficialPacks

func (r *Registry) OfficialPacks() []Pack

OfficialPacks returns the packs flagged as official packs.

func (*Registry) Select

func (r *Registry) Select(names []string) ([]Pack, error)

Select resolves pack names to their entries, preserving the order given. It errors on the first unknown name.

Jump to

Keyboard shortcuts

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