registry

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package registry manages the repo registry at ~/.wt/repos.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {
	Repos []Repo `json:"repos"`
}

Registry holds all registered repos

func Load

func Load(path string) (*Registry, error)

Load reads the registry from the specified path, or ~/.wt/repos.json if empty. Returns empty registry if file doesn't exist (auto-creates ~/.wt/).

func (*Registry) Add

func (r *Registry) Add(repo Repo) error

Add registers a new repo. Returns error if path already registered.

func (*Registry) AddLabel

func (r *Registry) AddLabel(repoName, label string) error

AddLabel adds a label to a repo

func (*Registry) AllLabels

func (r *Registry) AllLabels() []string

AllLabels returns all unique labels across all repos

func (*Registry) AllRepoNames

func (r *Registry) AllRepoNames() []string

AllRepoNames returns all repo names

func (*Registry) ClearLabels

func (r *Registry) ClearLabels(repoName string) error

ClearLabels removes all labels from a repo

func (*Registry) Find

func (r *Registry) Find(ref string) (Repo, error)

Find looks up a repo by name or path

func (*Registry) FindByLabel

func (r *Registry) FindByLabel(label string) []Repo

FindByLabel returns all repos with the given label

func (*Registry) FindByLabels

func (r *Registry) FindByLabels(labels []string) []Repo

FindByLabels returns repos matching any of the given labels

func (*Registry) FindByName

func (r *Registry) FindByName(name string) (Repo, error)

FindByName looks up a repo by name only

func (*Registry) FindByPath

func (r *Registry) FindByPath(path string) (Repo, error)

FindByPath looks up a repo by path

func (*Registry) Remove

func (r *Registry) Remove(nameOrPath string) error

Remove unregisters a repo by name or path

func (*Registry) RemoveLabel

func (r *Registry) RemoveLabel(repoName, label string) error

RemoveLabel removes a label from a repo

func (*Registry) Save

func (r *Registry) Save(path string) error

Save writes the registry to the specified path, or ~/.wt/repos.json if empty.

func (*Registry) Update

func (r *Registry) Update(name string, fn func(*Repo)) error

Update updates a repo's configuration

type Repo

type Repo struct {
	Path           string   `json:"path"`                      // Absolute path to repo
	Name           string   `json:"name"`                      // Display name
	WorktreeFormat string   `json:"worktree_format,omitempty"` // Optional per-repo override
	Labels         []string `json:"labels,omitempty"`          // Labels for grouping
}

Repo represents a registered git repository

func (*Repo) GetEffectiveWorktreeFormat

func (repo *Repo) GetEffectiveWorktreeFormat(defaultFormat string) string

GetEffectiveWorktreeFormat returns the worktree format to use for this repo

func (*Repo) HasLabel

func (repo *Repo) HasLabel(label string) bool

HasLabel checks if a repo has a specific label

func (*Repo) MatchesLabels

func (repo *Repo) MatchesLabels(labels []string) bool

MatchesLabels checks if repo has any of the given labels

func (*Repo) PathExists added in v0.15.0

func (repo *Repo) PathExists() (bool, error)

PathExists returns true if the repo path exists on disk. Returns an error for non-existence errors (e.g. permission denied).

func (*Repo) String

func (repo *Repo) String() string

String returns a display string for the repo

Jump to

Keyboard shortcuts

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