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 ¶
- Variables
- func CompletionFunc() cobra.CompletionFunc
- func GetBranchForRepo(ctx context.Context, repoName string) string
- func GetLabelsForRepo(name string) []string
- func GetProjectForRepo(ctx context.Context, repoName string) string
- func GetRepository(ctx context.Context, repoName string) (*scm.Repository, bool)
- func Init(ctx context.Context, flush bool)
- func NoCompletion() cobra.CompletionFunc
- func ProjectOrder(ctx context.Context) []string
- func RepositoryList(ctx context.Context, filters ...string) mapset.Set[string]
- func ResolveName(ctx context.Context, name string) string
- type Label
- type LabelGroup
Constants ¶
This section is empty.
Variables ¶
var Catalog = make(map[string]scm.Repository)
Catalog contains a cached set of repositories and their metadata from Bitbucket
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
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
GetLabelsForRepo returns the names of all labels that include the given repository name.
func GetProjectForRepo ¶ added in v0.9.6
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
GetRepository retrieves a repository from the catalog by name. Bare names are resolved to their canonical project-qualified form before lookup.
func Init ¶
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
ProjectOrder returns the configured projects in precedence order: the default project first, followed by each additional project in order of inclusion.
func RepositoryList ¶
RepositoryList returns the set of repository names matching the given filters.
func ResolveName ¶ added in v1.1.0
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 LabelGroup ¶ added in v0.9.6
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.