catalog

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package catalog provides repository discovery, selector expansion, and cache-backed metadata for batch-tool command workflows.

The package resolves repository sets from direct names and filter tokens such as labels and exclusions, then exposes consistent ordering and lookup helpers for command packages.

Index

Constants

This section is empty.

Variables

View Source
var Catalog = make(map[string]scm.Repository)

Catalog contains a cached set of repositories and their metadata from Bitbucket

View Source
var Labels = make(map[string]mapset.Set[string])

Labels contains a mapping of label names with the set of repositories matching each label

Functions

func CompletionFunc added in v0.9.6

func CompletionFunc() cobra.CompletionFunc

CompletionFunc provides shell completion suggestions based on the currently-known repositories and labels.

func GetBranchForRepo added in v0.10.0

func GetBranchForRepo(ctx context.Context, repoName string) string

GetBranchForRepo returns the default branch for a given repository name. It checks the catalog first, then falls back to the configured default.

func GetLabelsForRepo added in v1.0.0

func GetLabelsForRepo(name string) []string

GetLabelsForRepo returns the names of all labels that include the given repository name.

func GetProjectForRepo added in v0.9.6

func GetProjectForRepo(ctx context.Context, repoName string) string

GetProjectForRepo returns the project for a given repository name. It checks the catalog first, then falls back to the default project.

func GetRepository added in v0.9.6

func GetRepository(ctx context.Context, repoName string) (*scm.Repository, bool)

GetRepository retrieves a repository from the catalog by name. Bare names are resolved to their canonical project-qualified form before lookup.

func Init

func Init(ctx context.Context, flush bool)

Init initializes the repository catalog and label mappings, updating the cache if necessary (based on configured TTL).

func NoCompletion added in v0.9.6

func NoCompletion() cobra.CompletionFunc

NoCompletion provides a no-op completion function to disable file completions for interstitial commands.

func ProjectOrder added in v1.1.0

func ProjectOrder(ctx context.Context) []string

ProjectOrder returns the configured projects in precedence order: the default project first, followed by each additional project in order of inclusion.

func RepositoryList

func RepositoryList(ctx context.Context, filters ...string) mapset.Set[string]

RepositoryList returns the set of repository names matching the given filters.

func ResolveName added in v1.1.0

func ResolveName(ctx context.Context, name string) string

ResolveName returns the canonical project-qualified name for the given repository selector. Names which already carry a project prefix are normalized and returned as-is, deferring to the provided project without consulting the catalog. Bare names are matched against the catalog, with collisions resolved in favor of the default project first and then each additional configured project in order of inclusion. Names which are unknown to the catalog fall back to the default project so they can still be cloned and processed.

Types

type Label added in v0.9.6

type Label struct {
	mapset.Set[string]
}

Label represents a logical grouping of repository names.

func (*Label) String added in v0.9.6

func (l *Label) String() string

String provides a set-theory representation of the Label.

type LabelGroup added in v0.9.6

type LabelGroup struct {
	Forced   Label
	Included Label
	Excluded Label
}

LabelGroup holds categorized label names extracted from a list of filter arguments.

func ParseLabels added in v0.9.6

func ParseLabels(ctx context.Context, filters ...string) (LabelGroup, []string)

ParseLabels constructs a parsed group of labels based on the provided filters, along with the list of matching repositories from the local cache.

func (LabelGroup) String added in v0.9.6

func (lg LabelGroup) String() string

String provides a set-theory representation of the LabelGroup.

(forced ∪ (included ∖ excluded))

func (LabelGroup) ToSlices added in v0.9.6

func (lg LabelGroup) ToSlices() (forced, included, excluded []string)

ToSlices converts the LabelGroup sets to sorted slices.

Jump to

Keyboard shortcuts

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