Documentation
¶
Index ¶
- Constants
- Variables
- func AddGlobalRepoOverride(cmd *cobra.Command, f Factory)
- func CancelError(log ...any) error
- func ConfirmTransfer() error
- func EditorPrompt(response *string, question, templateContent, editorCommand string) error
- func EnableRepoOverride(cmd *cobra.Command, f Factory)
- func GetEditor(cf func() config.Config) (string, error)
- func GroupOverride(cmd *cobra.Command) (string, error)
- func IDsFromUsers(users []*gitlab.User) *[]int
- func LabelsPrompt(response *[]string, apiClient *gitlab.Client, repoRemote *glrepo.Remote) error
- func ListGitLabTemplates(tmplType string) ([]string, error)
- func LoadGitLabTemplate(tmplType, tmplName string) (string, error)
- func MilestonesPrompt(response *int, apiClient *gitlab.Client, repoRemote *glrepo.Remote, ...) error
- func MinimumArgs(n int, msg string) cobra.PositionalArgs
- func NewEnumValue(allowed []string, d string, v *string) *enumValue
- func ParseMilestone(apiClient *gitlab.Client, repo glrepo.Interface, milestoneTitle string) (int, error)
- func UsersPrompt(response *[]string, apiClient *gitlab.Client, repoRemote *glrepo.Remote, ...) error
- type Action
- type DefaultFactory
- func (f *DefaultFactory) ApiClient(repoHost string) (*api.Client, error)
- func (f *DefaultFactory) BaseRepo() (glrepo.Interface, error)
- func (f *DefaultFactory) Branch() (string, error)
- func (f *DefaultFactory) BuildInfo() api.BuildInfo
- func (f *DefaultFactory) Config() config.Config
- func (f *DefaultFactory) DefaultHostname() string
- func (f *DefaultFactory) HttpClient() (*gitlab.Client, error)
- func (f *DefaultFactory) IO() *iostreams.IOStreams
- func (f *DefaultFactory) Remotes() (glrepo.Remotes, error)
- func (f *DefaultFactory) RepoOverride(repo string) error
- type ExitError
- type Factory
- type FlagError
- type GetTextUsingEditor
- type UserAssignmentType
- type UserAssignments
Constants ¶
const ( IssueTemplate = "issue_templates" MergeRequestTemplate = "merge_request_templates" )
Variables ¶
var GroupMemberLevel = map[int]string{
0: "no access",
5: "minimal access",
10: "guest",
20: "reporter",
30: "developer",
40: "maintainer",
50: "owner",
}
GroupMemberLevel maps a number representing the access level to a string shown to the user. API docs: https://docs.gitlab.com/ce/api/members.html#valid-access-levels
var SilentError = errors.New("SilentError")
SilentError is an error that triggers exit Code 1 without any error messaging
Functions ¶
func AddGlobalRepoOverride ¶
AddGlobalRepoOverride adds the -R flag globally but keeps it hidden
func CancelError ¶
func ConfirmTransfer ¶
func ConfirmTransfer() error
func EditorPrompt ¶
func EnableRepoOverride ¶
func IDsFromUsers ¶
IDsFromUsers collects all user IDs from a slice of users
func LabelsPrompt ¶
func ListGitLabTemplates ¶
TODO: properly handle errors in this function.
For now, it returns nil and empty slice if there's an error
func LoadGitLabTemplate ¶
LoadGitLabTemplate finds and loads the GitLab template from the working git directory Follows the format officially supported by GitLab https://docs.gitlab.com/user/project/description_templates/#set-a-default-template-for-merge-requests-and-issues.
TODO: load from remote repository if repo is overridden by -R flag
func MilestonesPrompt ¶
func MinimumArgs ¶
func MinimumArgs(n int, msg string) cobra.PositionalArgs
func NewEnumValue ¶ added in v1.64.0
func ParseMilestone ¶
func UsersPrompt ¶
func UsersPrompt(response *[]string, apiClient *gitlab.Client, repoRemote *glrepo.Remote, io *iostreams.IOStreams, minimumAccessLevel int, role string) error
UsersPrompt creates a multi-selection prompt of all the users above the given access level for the remote referenced by the `*glrepo.Remote`.
`role` will appear on the prompt to keep the user informed of the reason of the selection.
Types ¶
type DefaultFactory ¶
type DefaultFactory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func (*DefaultFactory) ApiClient ¶
func (f *DefaultFactory) ApiClient(repoHost string) (*api.Client, error)
func (*DefaultFactory) Branch ¶
func (f *DefaultFactory) Branch() (string, error)
func (*DefaultFactory) BuildInfo ¶
func (f *DefaultFactory) BuildInfo() api.BuildInfo
func (*DefaultFactory) Config ¶
func (f *DefaultFactory) Config() config.Config
func (*DefaultFactory) DefaultHostname ¶
func (f *DefaultFactory) DefaultHostname() string
func (*DefaultFactory) HttpClient ¶
func (f *DefaultFactory) HttpClient() (*gitlab.Client, error)
func (*DefaultFactory) IO ¶
func (f *DefaultFactory) IO() *iostreams.IOStreams
func (*DefaultFactory) RepoOverride ¶
func (f *DefaultFactory) RepoOverride(repo string) error
type Factory ¶
type Factory interface { RepoOverride(repo string) error ApiClient(repoHost string) (*api.Client, error) // HttpClient returns an HTTP client that is initialize with the host from BaseRepo. // You must only use HttpClient if your command is tied to a single repository, // otherwise use ApiClient HttpClient() (*gitlab.Client, error) BaseRepo() (glrepo.Interface, error) Remotes() (glrepo.Remotes, error) Config() config.Config Branch() (string, error) IO() *iostreams.IOStreams DefaultHostname() string BuildInfo() api.BuildInfo }
Factory is a way to obtain core tools for the commands. Safe for concurrent use.
type FlagError ¶
type FlagError struct {
Err error
}
FlagError is the kind of error raised in flag processing
type GetTextUsingEditor ¶
type UserAssignmentType ¶
type UserAssignmentType int
const ( AssigneeAssignment UserAssignmentType = iota ReviewerAssignment )
type UserAssignments ¶
type UserAssignments struct { ToAdd []string ToRemove []string ToReplace []string AssignmentType UserAssignmentType }
UserAssignments holds 3 slice strings that represent which assignees should be added, removed, and replaced helper functions are also provided
func ParseAssignees ¶
func ParseAssignees(assignees []string) *UserAssignments
ParseAssignees takes a String Slice and splits them into 3 Slice Strings based on the first character of a string.
'+' is put in the first slice, '!' and '-' in the second slice and all other cases in the third slice.
The 3 String slices are returned regardless if anything was put it in or not the user is responsible for checking the length to see if anything is in it
func (*UserAssignments) UsersFromAddRemove ¶
func (ua *UserAssignments) UsersFromAddRemove( issueAssignees []*gitlab.IssueAssignee, mergeRequestAssignees []*gitlab.BasicUser, apiClient *gitlab.Client, actions []string, ) (*[]int, []string, error)
UsersFromAddRemove works with both `ToAdd` and `ToRemove` members to produce a Slice of Ints that represents the final collection of IDs to assigned.
It starts by getting all IDs already assigned, but ignoring ones present in `ToRemove`, it then converts all `usernames` in `ToAdd` into IDs by using the `api` package and adds them to the IDs to be assigned
func (*UserAssignments) UsersFromReplaces ¶
func (ua *UserAssignments) UsersFromReplaces(apiClient *gitlab.Client, actions []string) (*[]int, []string, error)
UsersFromReplaces converts all users from the `ToReplace` member of the struct into an Slice of String representing the Users' IDs, it also takes a Slice of Strings and writes a proper action message to it
func (*UserAssignments) VerifyAssignees ¶
func (ua *UserAssignments) VerifyAssignees() error
VerifyAssignees is a method for UserAssignments that checks them for validity