repository

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OperateOnRepos

func OperateOnRepos(config *config.GitXargsConfig) error

There are three ways to select repos to operate on via this tool: 1. the --repo flag, which specifies a single repo, and which can be passed multiple times, e.g., --repo gruntwork-io/fetch --repo gruntwork-io/cloud-nuke, etc 2. the --repos flag which specifies the path to the user-defined flatfile of repos in the format of 'gruntwork-io/cloud-nuke', one repo per line 3. the --github-org flag which specifies the Github organization that should have all its repos fetched via API

This function acts as a switch, depending upon whether or not the user provided an explicit list of repos to operate

However, even though there are two methods for users to select repos, we still only want a single uniform interface for dealing with a repo throughout this tool, and that is the *github.Repository type provided by the go-github library. Therefore, this function serves the purpose of creating that uniform interface, by looking up flatfile-provided repos via go-github, so that we're only ever dealing with pointers to github.Repositories going forward

func ProcessRepos

func ProcessRepos(gitxargsConfig *config.GitXargsConfig, repos []*github.Repository) error

Loop through every repo we've selected and use a WaitGroup so that the processing can happen in parallel

Types

type RepoSelection

type RepoSelection struct {
	SelectionType          RepoSelectionCriteria
	AllowedRepos           []*types.AllowedRepo
	GithubOrganizationName string
}

RepoSelection is a struct that presents a uniform interface to present to OperateRepos that converts user-supplied repos in the format of <org-name>/<repo-name> to Github API response objects that we actually pass into processRepos which does the git cloning, command execution, comitting and pull request opening

func (RepoSelection) GetAllowedRepos

func (r RepoSelection) GetAllowedRepos() []*types.AllowedRepo

func (RepoSelection) GetCriteria

func (r RepoSelection) GetCriteria() RepoSelectionCriteria

func (RepoSelection) GetGithubOrg

func (r RepoSelection) GetGithubOrg() string

type RepoSelectionCriteria

type RepoSelectionCriteria string
const (
	ReposViaStdIn              RepoSelectionCriteria = "repo-stdin"
	ExplicitReposOnCommandLine RepoSelectionCriteria = "repo-flag"
	ReposFilePath              RepoSelectionCriteria = "repos-file"
	GithubOrganization         RepoSelectionCriteria = "github-org"
)

Jump to

Keyboard shortcuts

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