cmdutils

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: MIT Imports: 19 Imported by: 1

Documentation

Overview

Forked from https://github.com/cli/cli/blob/929e082c13909044e2585af292ae952c9ca6f25c/pkg/cmd/factory/default.go

Index

Constants

View Source
const (
	IssueTemplate        = "issue_templates"
	MergeRequestTemplate = "merge_request_templates"
)

Variables

View Source
var (
	CachedConfig config.Config
	ConfigError  error
)
View Source
var SilentError = errors.New("SilentError")

SilentError is an error that triggers exit code 1 without any error messaging

Functions

func DescriptionPrompt added in v1.12.0

func DescriptionPrompt(response *string, templateContent, editorCommand string) error

func EnableRepoOverride

func EnableRepoOverride(cmd *cobra.Command, f *Factory)

func GetEditor added in v1.12.0

func GetEditor(cf func() (config.Config, error)) (string, error)

func HTTPClientFactory

func HTTPClientFactory(f *Factory)

func LabClientFunc added in v1.12.0

func LabClientFunc(repoHost string, cfg config.Config, isGraphQL bool) (*gitlab.Client, error)

func LabelsPrompt added in v1.12.0

func LabelsPrompt(response *string, apiClient *gitlab.Client, repoRemote *glrepo.Remote) (err error)

func ListGitLabTemplates added in v1.12.0

func ListGitLabTemplates(tmplType string) ([]string, error)

TODO: properly handle errors in this function.

For now, it returns nil and empty slice if there's an error

func LoadGitLabTemplate added in v1.12.0

func LoadGitLabTemplate(tmplType, tmplName string) (string, error)

LoadGitLabTemplate finds and loads the GitLab template from the working git directory Follows the format officially supported by GitLab https://docs.gitlab.com/ee/user/project/description_templates.html#setting-a-default-template-for-issues-and-merge-requests.

TODO: load from remote repository if repo is overriden by -R flag

func OverrideAPIProtocol

func OverrideAPIProtocol(cfg config.Config, repo glrepo.Interface)

OverrideAPIProtocol sets api protocol for host to initialize http client

Types

type Factory

type Factory struct {
	HttpClient func() (*gitlab.Client, error)
	BaseRepo   func() (glrepo.Interface, error)
	Remotes    func() (glrepo.Remotes, error)
	Config     func() (config.Config, error)
	Branch     func() (string, error)
	IO         *utils.IOStreams
}

func NewFactory

func NewFactory() *Factory

func (*Factory) RepoOverride

func (f *Factory) RepoOverride(repo string) error

type FlagError

type FlagError struct {
	Err error
}

FlagError is the kind of error raised in flag processing

func (FlagError) Error

func (fe FlagError) Error() string

func (FlagError) Unwrap

func (fe FlagError) Unwrap() error

Jump to

Keyboard shortcuts

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