Documentation
¶
Index ¶
- Variables
- func GetRepositoryAllowedSlugs(ctx context.Context, cmd *cobra.Command, args []string, toComplete string) (slugs []string, err error)
- func GetRepositoryName(context context.Context, cmd *cobra.Command) (repositoryName string, err error)
- func GetRepositorySlugs(ctx context.Context, cmd *cobra.Command) (slugs []string, err error)
- func GitClone(context context.Context, workspace, repository, destination, username string) (err error)
- type Repositories
- type Repository
- func GetRepositories(ctx context.Context, cmd *cobra.Command) ([]Repository, error)
- func GetRepositoriesWithQuery(ctx context.Context, cmd *cobra.Command, query url.Values) ([]Repository, error)
- func GetRepository(ctx context.Context, cmd *cobra.Command) (repository *Repository, err error)
- func GetRepositoryBySlugOrID(ctx context.Context, cmd *cobra.Command, slugOrID string) (repository *Repository, err error)
- func GetRepositoryFromGit(context context.Context, cmd *cobra.Command, profile *profile.Profile) (repository *Repository, err error)
- func (repository Repository) GetEffectiveDefaultReviewers(ctx context.Context, cmd *cobra.Command) (reviewers []reviewer.Reviewer, err error)
- func (repository Repository) GetForks(ctx context.Context, cmd *cobra.Command) (forks []Repository, err error)
- func (repository Repository) GetHeaders(cmd *cobra.Command) []string
- func (repository Repository) GetID() uuid.UUID
- func (repository Repository) GetName() string
- func (repository Repository) GetPath(paths ...string) string
- func (repository Repository) GetRow(headers []string) []string
- func (repository Repository) GetType() string
- func (repository Repository) MarshalJSON() (data []byte, err error)
- func (repository Repository) String() string
- func (repository *Repository) UnmarshalJSON(data []byte) (err error)
- func (repository *Repository) Validate() error
- type RepositoryCreator
- type RepositoryForkCreator
- type RepositoryUpdator
Constants ¶
This section is empty.
Variables ¶
var Command = &cobra.Command{ Use: "repo", Aliases: []string{"repository"}, Short: "Manage repositories", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Workspace requires a subcommand:") for _, command := range cmd.Commands() { fmt.Println(command.Name()) } }, }
Command represents this folder's command
var RepositoryCache = common.NewCache[Repository]()
Functions ¶
func GetRepositoryAllowedSlugs ¶
func GetRepositoryAllowedSlugs(ctx context.Context, cmd *cobra.Command, args []string, toComplete string) (slugs []string, err error)
GetRepositoryAllowedSlugs gets the slugs of all repositories to use with enum flags
func GetRepositoryName ¶
func GetRepositoryName(context context.Context, cmd *cobra.Command) (repositoryName string, err error)
GetRepositoryName gets the name of the repository from the command line or from the git config
func GetRepositorySlugs ¶
GetRepositorySlugs gets the slugs of all repositories
Types ¶
type Repositories ¶
type Repositories []Repository
func (Repositories) GetHeaders ¶
func (repositories Repositories) GetHeaders(cmd *cobra.Command) []string
GetHeaders gets the header for a table
implements common.Tableables
func (Repositories) GetRowAt ¶
func (repositories Repositories) GetRowAt(index int, headers []string) []string
GetRowAt gets the row for a table
implements common.Tableables
func (Repositories) Size ¶
func (repositories Repositories) Size() int
Size gets the number of elements
implements common.Tableables
type Repository ¶
type Repository struct {
ID common.UUID `json:"uuid" mapstructure:"uuid"`
Name string `json:"name,omitempty" mapstructure:"name"`
FullName string `json:"full_name,omitempty" mapstructure:"full_name"`
Slug string `json:"slug,omitempty" mapstructure:"slug"`
Owner user.User `json:"owner,omitempty" mapstructure:"owner"`
Workspace workspace.Workspace `json:"workspace,omitempty" mapstructure:"workspace"`
Project project.Project `json:"project,omitempty" mapstructure:"project"`
HasIssues bool `json:"has_issues" mapstructure:"has_issues"`
HasWiki bool `json:"has_wiki" mapstructure:"has_wiki"`
IsPrivate bool `json:"is_private" mapstructure:"is_private"`
ForkPolicy string `json:"fork_policy,omitempty" mapstructure:"fork_policy"`
Size int64 `json:"size,omitempty" mapstructure:"size"`
Language string `json:"language,omitempty" mapstructure:"language"`
MainBranch string `json:"-" mapstructure:"-"`
DefaultMergeStrategy string `json:"-" mapstructure:"-"`
BranchingModel string `json:"-" mapstructure:"-"`
Parent *Repository `json:"parent,omitempty" mapstructure:"parent"`
Links common.Links `json:"links" mapstructure:"links"`
CreatedOn time.Time `json:"created_on" mapstructure:"created_on"`
UpdatedOn time.Time `json:"updated_on" mapstructure:"updated_on"`
}
func GetRepositories ¶
GetRepositories gets the repositories for a workspace
func GetRepositoriesWithQuery ¶
func GetRepositoriesWithQuery(ctx context.Context, cmd *cobra.Command, query url.Values) ([]Repository, error)
GetRepositoriesWithQuery gets the repositories for a workspace with a query
func GetRepository ¶
GetRepository gets a repository by its slug
func GetRepositoryBySlugOrID ¶
func GetRepositoryBySlugOrID(ctx context.Context, cmd *cobra.Command, slugOrID string) (repository *Repository, err error)
GetRepositoryBySlugOrID gets a repository by its slug name
If the slug is in the format "workspace/repository", the workspace is used to get the repository.
Otherwise, the workspace is determined by the git config or the default workspace in the profile.
func GetRepositoryFromGit ¶
func GetRepositoryFromGit(context context.Context, cmd *cobra.Command, profile *profile.Profile) (repository *Repository, err error)
GetRepositoryFromGit gets a repository from a git origin
func (Repository) GetEffectiveDefaultReviewers ¶
func (repository Repository) GetEffectiveDefaultReviewers(ctx context.Context, cmd *cobra.Command) (reviewers []reviewer.Reviewer, err error)
GetEffectiveDefaultReviewers gets the effective default reviewers for a repository
func (Repository) GetForks ¶
func (repository Repository) GetForks(ctx context.Context, cmd *cobra.Command) (forks []Repository, err error)
GetForks gets the forks of the repository
func (Repository) GetHeaders ¶
func (repository Repository) GetHeaders(cmd *cobra.Command) []string
GetHeaders gets the header for a table
implements common.Tableable
func (Repository) GetID ¶
func (repository Repository) GetID() uuid.UUID
GetID gets the ID of the repository
implements core.Identifiable
func (Repository) GetName ¶
func (repository Repository) GetName() string
GetName gets the name of the repository
implements core.Named
func (Repository) GetPath ¶
func (repository Repository) GetPath(paths ...string) string
GetPath gets the API path of the repository
func (Repository) GetRow ¶
func (repository Repository) GetRow(headers []string) []string
GetRow gets the row for a table
implements common.Tableable
func (Repository) GetType ¶
func (repository Repository) GetType() string
GetType gets the type of this repository
implements core.TypeCarrier
func (Repository) MarshalJSON ¶
func (repository Repository) MarshalJSON() (data []byte, err error)
MarshalJSON implements the json.Marshaler interface.
Implements json.Marshaler
func (Repository) String ¶
func (repository Repository) String() string
String returns the string representation of the repository
implements fmt.Stringer
func (*Repository) UnmarshalJSON ¶
func (repository *Repository) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON implements the json.Unmarshaler interface.
Implements json.Unmarshaler
func (*Repository) Validate ¶
func (repository *Repository) Validate() error
Validate validates a Repository
type RepositoryCreator ¶
type RepositoryCreator struct {
Name string `json:"name" mapstructure:"name"`
Description string `json:"description,omitempty" mapstructure:"description"`
Project *project.ProjectReference `json:"project,omitempty" mapstructure:"project"`
IsPrivate bool `json:"is_private" mapstructure:"is_private"`
Language string `json:"language,omitempty" mapstructure:"language"`
MainBranch *branch `json:"mainbranch,omitempty" mapstructure:"mainbranch"`
ForkPolicy string `json:"fork_policy,omitempty" mapstructure:"fork_policy"`
}
type RepositoryForkCreator ¶
type RepositoryForkCreator struct {
Name string `json:"name" mapstructure:"name"`
Description string `json:"description,omitempty" mapstructure:"description"`
Project *project.ProjectReference `json:"project,omitempty" mapstructure:"project"`
IsPrivate bool `json:"is_private" mapstructure:"is_private"`
Language string `json:"language,omitempty" mapstructure:"language"`
MainBranch *branch `json:"mainbranch,omitempty" mapstructure:"mainbranch"`
ForkPolicy string `json:"fork_policy,omitempty" mapstructure:"fork_policy"`
}
type RepositoryUpdator ¶
type RepositoryUpdator struct {
Name string `json:"name,omitempty" mapstructure:"name"`
Description string `json:"description,omitempty" mapstructure:"description"`
Project *project.ProjectReference `json:"project,omitempty" mapstructure:"project"`
IsPrivate *bool `json:"is_private,omitempty" mapstructure:"is_private"`
Language string `json:"language,omitempty" mapstructure:"language"`
MainBranch *branch `json:"mainbranch,omitempty" mapstructure:"mainbranch"`
ForkPolicy string `json:"fork_policy,omitempty" mapstructure:"fork_policy"`
}