cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const RemoteReposChannelSize = SyncWorkerPoolSize * 20 // buffer 20 repos per worker
View Source
const SyncWorkerPoolSize = 100

Variables

View Source
var ErrRepoNotFound = errors.New("repo not found")
View Source
var KnownGitProviders = []RepoProvider{
	NewGithubRepoProvider(),
}

Functions

func Execute

func Execute(version string)

func NewSyncReposWorkerPool

func NewSyncReposWorkerPool(ctx context.Context, clone, update, archive bool, progressWriter *ProgressLogger) *syncReposWorkerPool

Types

type FilePath added in v0.4.0

type FilePath string

type GithubRepoProvider

type GithubRepoProvider struct {
	// contains filtered or unexported fields
}

func NewGithubRepoProvider

func NewGithubRepoProvider() GithubRepoProvider

func (GithubRepoProvider) GetRepo added in v0.4.0

func (gh GithubRepoProvider) GetRepo(ctx context.Context, repoUrl string) (RemoteRepo, error)

func (GithubRepoProvider) IsMatch

func (p GithubRepoProvider) IsMatch(s string) bool

func (GithubRepoProvider) ListRepos

func (gh GithubRepoProvider) ListRepos(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GithubRepoProvider) ListReposByOrg

func (gh GithubRepoProvider) ListReposByOrg(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GithubRepoProvider) ListReposByUser

func (gh GithubRepoProvider) ListReposByUser(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GithubRepoProvider) NormaliseGitUrl

func (p GithubRepoProvider) NormaliseGitUrl(s string) string

type GitlabRepoProvider

type GitlabRepoProvider struct {
	// contains filtered or unexported fields
}

func NewGitlabRepoProvider

func NewGitlabRepoProvider(host string) GitlabRepoProvider

func (GitlabRepoProvider) GetRepo added in v0.4.0

func (gl GitlabRepoProvider) GetRepo(ctx context.Context, repoName string) (RemoteRepo, error)

func (GitlabRepoProvider) IsMatch

func (p GitlabRepoProvider) IsMatch(s string) bool

func (GitlabRepoProvider) ListRepos

func (gl GitlabRepoProvider) ListRepos(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GitlabRepoProvider) ListReposByOrg added in v0.3.0

func (gl GitlabRepoProvider) ListReposByOrg(ctx context.Context, client *gitlab.Client, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GitlabRepoProvider) ListReposByUser added in v0.3.0

func (gl GitlabRepoProvider) ListReposByUser(ctx context.Context, client *gitlab.Client, user string, includeArchived bool, remoteRepoChan chan RemoteRepo) error

func (GitlabRepoProvider) NormaliseGitUrl

func (p GitlabRepoProvider) NormaliseGitUrl(s string) string

type ProgressLogger

type ProgressLogger struct {
	Printer             *syncprinter.Printer
	WriterFor           func(localDir string) io.Writer
	LogSyncedRepo       bool
	LogExecCmd          bool
	LogRealtimeProgress bool
	LogInfo             bool
	// contains filtered or unexported fields
}

func NewProgressLogger

func NewProgressLogger(logLevel string) *ProgressLogger

func (*ProgressLogger) AddTotalToProgress

func (p *ProgressLogger) AddTotalToProgress(n int32)

func (*ProgressLogger) EndProgressLine

func (p *ProgressLogger) EndProgressLine(doneMsg string)

func (*ProgressLogger) EventArchivedRepo

func (p *ProgressLogger) EventArchivedRepo(localDir string)

func (*ProgressLogger) EventClonedRepo

func (p *ProgressLogger) EventClonedRepo(localDir string)

func (*ProgressLogger) EventExecCmd

func (p *ProgressLogger) EventExecCmd(cmd, dir string)

func (*ProgressLogger) EventIgnoredArchivedRepo

func (p *ProgressLogger) EventIgnoredArchivedRepo(localDir string)

func (*ProgressLogger) EventIgnoredRepo

func (p *ProgressLogger) EventIgnoredRepo(localDir string)

func (*ProgressLogger) EventSkippedRepo

func (p *ProgressLogger) EventSkippedRepo(localDir string)

func (*ProgressLogger) EventSyncedRepoError

func (p *ProgressLogger) EventSyncedRepoError(localDir string)

func (*ProgressLogger) EventUpdatedRepo

func (p *ProgressLogger) EventUpdatedRepo(localDir string)

func (*ProgressLogger) Info

func (p *ProgressLogger) Info(s string)

func (*ProgressLogger) InfoWithSignalInteruptRaceDelay added in v0.3.0

func (p *ProgressLogger) InfoWithSignalInteruptRaceDelay(ctx context.Context, s string)

InfoWithSignalInteruptRaceDelay is a special case of Info that is used to print a message that might be interrupted by a signal interrupt. If the message is a signal interrupt message, it will delay the message by 1s to avoid prematurely spamming the terminal with multiple signal interrupt messages.

func (*ProgressLogger) PrintProgressLine

func (p *ProgressLogger) PrintProgressLine()

type RemoteRepo added in v0.4.0

type RemoteRepo struct {
	RepoName      RepoName
	CloneUrl      string
	IsArchived    bool
	DefaultBranch string
}

type RepoName added in v0.4.0

type RepoName struct {
	Host string
	Path string
}

RepoName is the full name of a repository in the format "provider.tld/path"

func MustParseRepoName added in v0.4.0

func MustParseRepoName(rawName string) RepoName

func ParseRepoName added in v0.4.0

func ParseRepoName(rawName string) (RepoName, error)

func (RepoName) GitUrl added in v0.4.0

func (r RepoName) GitUrl() string

func (RepoName) LocalPathAbsolute added in v0.4.0

func (r RepoName) LocalPathAbsolute() string

func (RepoName) String added in v0.4.0

func (r RepoName) String() string

type RepoProvider

type RepoProvider interface {
	IsMatch(s string) bool
	NormaliseGitUrl(s string) string
	ListRepos(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan RemoteRepo) error
	GetRepo(ctx context.Context, repoName string) (RemoteRepo, error)
}

func RepoProviderFor

func RepoProviderFor(s string) (RepoProvider, error)

type TidyAction added in v0.4.0

type TidyAction struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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