cmd

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_ACCESS_MISSING = "The repository %s doesn't have the user."
	ERR_ACCESS_WRONG   = "The repository %s's user's permission is incorrect."
	ERR_BRANCH_DEFAULT = "The default branch should be '%s', not '%s'."
	ERR_LABEL_EXTRA    = "The label '%s' is present and shouldn't be."
	ERR_LABEL_MISSING  = "The label '%s' is missing."
	ERR_LICENSE        = "The license should be '%s', not '%s'."
	ERR_CO_DIFFERENT   = "The CODEOWNERS file is different from the policy."
	ERR_CO_MISSING     = "The CODEOWNERS file is not present."
	ERR_CO_SYNTAX      = "The CODEOWNERS file has syntax errors:\n%s"
)

Variables

This section is empty.

Functions

func AddPolicyFileFlag added in v0.5.0

func AddPolicyFileFlag(cmd *cobra.Command)

func AddRepositoriesFileFlag added in v0.5.0

func AddRepositoriesFileFlag(cmd *cobra.Command)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

Types

type LicenseRule added in v0.2.0

type LicenseRule struct {
	Scope string   `yaml:"scope"`
	Names []string `yaml:"names"`
}

type PolicyError added in v0.7.0

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

Represents a error when applying a policy, with contextual information.

func (PolicyError) Error added in v0.7.0

func (this PolicyError) Error() string

Properly print out a policy error.

type PolicyFile added in v0.5.0

type PolicyFile struct {
	DefaultBranch  string           `yaml:"defaultBranch"`
	Archived       bool             `yaml:"archived"` // include archived repos in lookup?
	License        *LicenseRule     `yaml:"license"`
	Labels         []string         `yaml:"labels"`
	LabelStrategy  string           `yaml:"labelStrategy"`
	Access         []UserPermission `yaml:"access"`
	AccessStrategy string           `yaml:"accessStrategy"`
	CodeOwners     string           `yaml:"codeowners"`
}

type Repo

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

type RepositoriesFile added in v0.6.0

type RepositoriesFile []*RepositoryGroup

============================================================================= A repositories.yml file =============================================================================

func (RepositoriesFile) Group added in v0.6.0

func (this RepositoriesFile) Group(groupName string) (*RepositoryGroup, error)

Get a group from a repositories file.

func (*RepositoriesFile) RepositoriesByGroup added in v0.6.0

func (this *RepositoriesFile) RepositoriesByGroup(group string) []RepositoryDefinition

Gets repositories from a repositories.yml file by group. The only group supported at this time is 'all'.

type RepositoryDefinition added in v0.5.0

type RepositoryDefinition struct {
	URL  string   `yaml:"url"`
	Tags []string `yaml:"tags,omitempty"`
}

type RepositoryGroup added in v0.6.0

type RepositoryGroup struct {
	Group        string                 `yaml:"group"`
	Repositories []RepositoryDefinition `yaml:"repositories"`
	Children     RepositoriesFile       `yaml:"children,omitempty"`
}

============================================================================= A list of repositories belonging to a group, the top-level object in a repositories.yml file. =============================================================================

func (*RepositoryGroup) Add added in v0.6.0

func (this *RepositoryGroup) Add(repoDef RepositoryDefinition)

Add a repository to the group

func (*RepositoryGroup) HasChildren added in v0.6.0

func (this *RepositoryGroup) HasChildren() bool

type UserPermission

type UserPermission struct {
	Username   string `yaml:"user"`
	Permission string `yaml:"permission"`
}

Jump to

Keyboard shortcuts

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