cmd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 29 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 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 GithubRepoProvider

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

func NewGithubRepoProvider

func NewGithubRepoProvider() GithubRepoProvider

func (GithubRepoProvider) GetOrgFromUrl

func (p GithubRepoProvider) GetOrgFromUrl(orgUrlArg string) (string, 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) GetOrgFromUrl

func (p GitlabRepoProvider) GetOrgFromUrl(orgUrlArg string) (string, 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 RepoProvider

type RepoProvider interface {
	IsMatch(s string) bool
	NormaliseGitUrl(s string) string
	GetOrgFromUrl(orgUrl string) (string, error)
	ListRepos(ctx context.Context, org string, includeArchived bool, remoteRepoChan chan remoteRepo) error
}

func RepoProviderFor

func RepoProviderFor(s string) (RepoProvider, error)

Jump to

Keyboard shortcuts

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