client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client wires together the repos and remotes layers and exposes a unified Client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliasNames added in v0.0.6

func AliasNames(ctx context.Context) ([]string, error)

AliasNames returns sorted global/system alias names, respecting Git's includes and environment.

Types

type Client

type Client struct {
	*repos.Repos
	// contains filtered or unexported fields
}

Client provides the full set of cross-repo git operations backed by the GitHub API.

func New

func New(cfg *config.Config, opts ...Option) (*Client, error)

New constructs a Client from cfg, initialising SSH auth, HTTPS auth, the GitHub API client, and rate limiter.

func (*Client) Add added in v0.0.2

func (c *Client) Add(ctx context.Context, dirs []string, name, baseURL string) error

Add runs git remote add across all dirs, building the remote URL from baseURL and each dir basename.

func (*Client) CloneAccounts added in v0.0.6

func (c *Client) CloneAccounts(ctx context.Context) ([]CloneAccount, error)

CloneAccounts returns the authenticated user and organizations available as clone targets.

func (*Client) GetDirs

func (c *Client) GetDirs(ctx context.Context, baseDir string) ([]string, error)

GetDirs discovers local repositories and validates invocation-scoped exclusions.

func (*Client) GetLogins

func (c *Client) GetLogins(ctx context.Context) ([]string, error)

GetLogins returns the authenticated user's login and all org logins, lowercased.

func (*Client) Remotes added in v0.0.2

func (c *Client) Remotes(ctx context.Context, dirs []string, args ...string) error

Remotes runs git remote across all dirs.

func (*Client) Remove added in v0.0.2

func (c *Client) Remove(ctx context.Context, dirs []string, name string) error

Remove runs git remote remove across all dirs.

func (*Client) Rename added in v0.0.5

func (c *Client) Rename(ctx context.Context, dirs []string, oldName, newName string) error

Rename runs git remote rename across all dirs.

func (*Client) SetURLs added in v0.0.2

func (c *Client) SetURLs(ctx context.Context, dirs []string, name, baseURL string) error

SetURLs runs git remote set-url across all dirs, building the URL from baseURL and each dir basename.

type Clienter added in v0.0.2

type Clienter interface {
	Add(ctx context.Context, dirs []string, name, baseURL string) error
	Branches(ctx context.Context, repoDirs []string, args ...string) error
	CheckoutRepos(ctx context.Context, repoDirs []string, args ...string) error
	CloneRepos(ctx context.Context, dir string) ([]*clientctx.Repository, error)
	CommitRepos(ctx context.Context, dirs []string, args ...string) error
	DiffRepos(ctx context.Context, repoDirs []string, cfg *repos.DiffConfig) error
	FetchRepos(ctx context.Context, repoDirs []string, args ...string) error
	GetBranchAndTagNames(ctx context.Context, dirs []string) ([]string, error)
	GetBranchNames(ctx context.Context, dirs []string) ([]string, error)
	GetDirs(ctx context.Context, dir string) ([]string, error)
	GetLogins(ctx context.Context) ([]string, error)
	GetRemoteNames(ctx context.Context, dirs []string) ([]string, error)
	GetRepos(ctx context.Context, name string) ([]*github.Repository, error)
	GetTagNames(ctx context.Context, dirs []string) ([]string, error)
	ListTags(ctx context.Context, repoDirs []string, ignoreEmpty bool, args ...string) error
	LogRepos(ctx context.Context, repoDirs []string, ignoreEmpty bool, args ...string) error
	MergeRepos(ctx context.Context, repoDirs []string, args ...string) error
	PullRepos(ctx context.Context, repoDirs []string, args ...string) error
	PushRepos(ctx context.Context, repoDirs []string, args ...string) error
	Remotes(ctx context.Context, repoDirs []string, args ...string) error
	Remove(ctx context.Context, dirs []string, name string) error
	Rename(ctx context.Context, dirs []string, oldName, newName string) error
	ResetRepos(ctx context.Context, repoDirs []string, args ...string) error
	RunAlias(ctx context.Context, dirs []string, name string, args ...string) error
	SetURLs(ctx context.Context, repoDirs []string, name, baseURL string) error
	StageFiles(ctx context.Context, dirs []string, args ...string) error
	StashRepos(ctx context.Context, dirs []string, args ...string) error
	StatusRepos(ctx context.Context, dirs []string, ignoreEmpty bool, args ...string) error
	TagRepos(ctx context.Context, repoDirs []string, args ...string) error
}

Clienter is the interface implemented by Client, used to inject fakes in cmd tests.

type CloneAccount added in v0.0.6

type CloneAccount struct {
	Login        string
	Name         string
	Description  string
	Organization bool
}

CloneAccount describes an account offered as a clone target.

type Option added in v0.0.6

type Option func(*clientOptions)

Option configures a Client.

func WithNoColor added in v0.0.6

func WithNoColor() Option

WithNoColor disables ANSI color codes in verbose output.

Directories

Path Synopsis
Package context provides request-scoped state helpers used throughout the align client.
Package context provides request-scoped state helpers used throughout the align client.
Package fanout runs Git jobs across repositories in a bounded rolling worker pool.
Package fanout runs Git jobs across repositories in a bounded rolling worker pool.
Package repos implements git operations fanned out across multiple repository directories.
Package repos implements git operations fanned out across multiple repository directories.

Jump to

Keyboard shortcuts

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