shared

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 17 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 BodySurvey added in v1.3.0

func BodySurvey(state *IssueMetadataState, templateContent, editorCommand string) error

func ColorForPR added in v1.2.1

func ColorForPR(pr api.PullRequest) string

func ColorForState added in v1.2.1

func ColorForState(state string) string

ColorForState returns a color constant for a PR/Issue state

func FillFromJSON added in v1.3.0

func FillFromJSON(io *iostreams.IOStreams, recoverFile string, state *IssueMetadataState) error

func FindTemplates added in v1.3.0

func FindTemplates(dir, path string) ([]string, string)

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 MetadataSurvey added in v1.3.0

func MetadataSurvey(io *iostreams.IOStreams, baseRepo ghrepo.Interface, fetcher RepoMetadataFetcher, state *IssueMetadataState) 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 PreserveInput added in v1.3.0

func PreserveInput(io *iostreams.IOStreams, state *IssueMetadataState, createErr *error) func()

func PrintHeader

func PrintHeader(io *iostreams.IOStreams, s string)

func PrintMessage

func PrintMessage(io *iostreams.IOStreams, s string)

func StateTitleWithColor

func StateTitleWithColor(cs *iostreams.ColorScheme, pr api.PullRequest) string

func TemplateSurvey added in v1.3.0

func TemplateSurvey(templateFiles []string, legacyTemplate string, state IssueMetadataState) (templateContent string, err error)

func TitleSurvey added in v1.3.0

func TitleSurvey(state *IssueMetadataState) error

func WithPrAndIssueQueryParams

func WithPrAndIssueQueryParams(baseURL string, state IssueMetadataState) (string, error)

Types

type Action

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

func ConfirmSubmission added in v1.3.0

func ConfirmSubmission(allowPreview bool, allowMetadata bool) (Action, error)

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

	Draft bool

	Body  string
	Title string

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

	MetadataResult *api.RepoMetadataResult
	// contains filtered or unexported fields
}

func (*IssueMetadataState) HasMetadata

func (tb *IssueMetadataState) HasMetadata() bool

func (*IssueMetadataState) IsDirty added in v1.3.0

func (tb *IssueMetadataState) IsDirty() bool

func (*IssueMetadataState) MarkDirty added in v1.3.0

func (tb *IssueMetadataState) MarkDirty()

type MetadataFetcher added in v1.3.1

type MetadataFetcher struct {
	IO        *iostreams.IOStreams
	APIClient *api.Client
	Repo      ghrepo.Interface
	State     *IssueMetadataState
}

func (*MetadataFetcher) RepoMetadataFetch added in v1.3.1

func (mf *MetadataFetcher) RepoMetadataFetch(input api.RepoMetadataInput) (*api.RepoMetadataResult, error)

type RepoMetadataFetcher added in v1.3.1

type RepoMetadataFetcher interface {
	RepoMetadataFetch(api.RepoMetadataInput) (*api.RepoMetadataResult, error)
}

Jump to

Keyboard shortcuts

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