Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OperateOnRepos ¶
func OperateOnRepos(config *config.GitXargsConfig) error
OperateOnRepos acts as a switch, depending upon whether the user provided an explicit list of repos to operate.
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 flat file 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.
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 flat file-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
ProcessRepos loops 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, committing 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" )