shared

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssueMetadata metadataStateType = iota
	PRMetadata
)

Variables

This section is empty.

Functions

func AddMetadataToIssueParams

func AddMetadataToIssueParams(client *api.Client, baseRepo ghrepo.Interface, params map[string]interface{}, tb *IssueMetadataState) error

func ColorFuncForPR

func ColorFuncForPR(pr api.PullRequest) func(string) string

func ColorFuncForState

func ColorFuncForState(state string) func(string) string

ColorFuncForState returns a color function for a PR/Issue state

func ListHeader

func ListHeader(repoName string, itemName string, matchCount int, totalMatchCount int, hasFilters bool) string

func ListURLWithQuery

func ListURLWithQuery(listURL string, options FilterOptions) (string, error)

func PRFromArgs

func PRFromArgs(apiClient *api.Client, baseRepoFn func() (ghrepo.Interface, error), branchFn func() (string, error), remotesFn func() (context.Remotes, error), arg string) (*api.PullRequest, ghrepo.Interface, error)

PRFromArgs looks up the pull request from either the number/branch/URL argument or one belonging to the current branch

NOTE: this API isn't great, but is here as a compatibility layer between old-style and new-style commands

func PrintHeader

func PrintHeader(w io.Writer, s string)

func PrintMessage

func PrintMessage(w io.Writer, s string)

func StateTitleWithColor

func StateTitleWithColor(pr api.PullRequest) string

func TitleBodySurvey

func TitleBodySurvey(io *iostreams.IOStreams, editorCommand string, issueState *IssueMetadataState, apiClient *api.Client, repo ghrepo.Interface, providedTitle, providedBody string, defs Defaults, nonLegacyTemplatePaths []string, legacyTemplatePath *string, allowReviewers, allowMetadata bool) error

FIXME: this command has too many parameters and responsibilities

func WithPrAndIssueQueryParams

func WithPrAndIssueQueryParams(baseURL, title, body string, assignees, labels, projects []string, milestones []string) (string, error)

Types

type Action

type Action int
const (
	SubmitAction Action = iota
	PreviewAction
	CancelAction
	MetadataAction
)

type Defaults

type Defaults struct {
	Title string
	Body  string
}

type FilterOptions

type FilterOptions struct {
	Entity     string
	State      string
	Assignee   string
	Labels     []string
	Author     string
	BaseBranch string
	Mention    string
	Milestone  string
}

type IssueMetadataState

type IssueMetadataState struct {
	Type metadataStateType

	Body   string
	Title  string
	Action Action

	Metadata   []string
	Reviewers  []string
	Assignees  []string
	Labels     []string
	Projects   []string
	Milestones []string

	MetadataResult *api.RepoMetadataResult
}

func (*IssueMetadataState) HasMetadata

func (tb *IssueMetadataState) HasMetadata() bool

Jump to

Keyboard shortcuts

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