"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/pr/view/view.go" between
gh-cli-1.12.1.tar.gz and gh-cli-1.13.1.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

view.go  (gh-cli-1.12.1):view.go  (gh-cli-1.13.1)
skipping to change at line 142 skipping to change at line 142
return printRawPrPreview(opts.IO, pr) return printRawPrPreview(opts.IO, pr)
} }
func printRawPrPreview(io *iostreams.IOStreams, pr *api.PullRequest) error { func printRawPrPreview(io *iostreams.IOStreams, pr *api.PullRequest) error {
out := io.Out out := io.Out
cs := io.ColorScheme() cs := io.ColorScheme()
reviewers := prReviewerList(*pr, cs) reviewers := prReviewerList(*pr, cs)
assignees := prAssigneeList(*pr) assignees := prAssigneeList(*pr)
labels := prLabelList(*pr) labels := prLabelList(*pr, cs)
projects := prProjectList(*pr) projects := prProjectList(*pr)
fmt.Fprintf(out, "title:\t%s\n", pr.Title) fmt.Fprintf(out, "title:\t%s\n", pr.Title)
fmt.Fprintf(out, "state:\t%s\n", prStateWithDraft(pr)) fmt.Fprintf(out, "state:\t%s\n", prStateWithDraft(pr))
fmt.Fprintf(out, "author:\t%s\n", pr.Author.Login) fmt.Fprintf(out, "author:\t%s\n", pr.Author.Login)
fmt.Fprintf(out, "labels:\t%s\n", labels) fmt.Fprintf(out, "labels:\t%s\n", labels)
fmt.Fprintf(out, "assignees:\t%s\n", assignees) fmt.Fprintf(out, "assignees:\t%s\n", assignees)
fmt.Fprintf(out, "reviewers:\t%s\n", reviewers) fmt.Fprintf(out, "reviewers:\t%s\n", reviewers)
fmt.Fprintf(out, "projects:\t%s\n", projects) fmt.Fprintf(out, "projects:\t%s\n", projects)
var milestoneTitle string var milestoneTitle string
skipping to change at line 200 skipping to change at line 200
// Metadata // Metadata
if reviewers := prReviewerList(*pr, cs); reviewers != "" { if reviewers := prReviewerList(*pr, cs); reviewers != "" {
fmt.Fprint(out, cs.Bold("Reviewers: ")) fmt.Fprint(out, cs.Bold("Reviewers: "))
fmt.Fprintln(out, reviewers) fmt.Fprintln(out, reviewers)
} }
if assignees := prAssigneeList(*pr); assignees != "" { if assignees := prAssigneeList(*pr); assignees != "" {
fmt.Fprint(out, cs.Bold("Assignees: ")) fmt.Fprint(out, cs.Bold("Assignees: "))
fmt.Fprintln(out, assignees) fmt.Fprintln(out, assignees)
} }
if labels := prLabelList(*pr); labels != "" { if labels := prLabelList(*pr, cs); labels != "" {
fmt.Fprint(out, cs.Bold("Labels: ")) fmt.Fprint(out, cs.Bold("Labels: "))
fmt.Fprintln(out, labels) fmt.Fprintln(out, labels)
} }
if projects := prProjectList(*pr); projects != "" { if projects := prProjectList(*pr); projects != "" {
fmt.Fprint(out, cs.Bold("Projects: ")) fmt.Fprint(out, cs.Bold("Projects: "))
fmt.Fprintln(out, projects) fmt.Fprintln(out, projects)
} }
if pr.Milestone != nil { if pr.Milestone != nil {
fmt.Fprint(out, cs.Bold("Milestone: ")) fmt.Fprint(out, cs.Bold("Milestone: "))
fmt.Fprintln(out, pr.Milestone.Title) fmt.Fprintln(out, pr.Milestone.Title)
skipping to change at line 370 skipping to change at line 370
AssigneeNames = append(AssigneeNames, assignee.Login) AssigneeNames = append(AssigneeNames, assignee.Login)
} }
list := strings.Join(AssigneeNames, ", ") list := strings.Join(AssigneeNames, ", ")
if pr.Assignees.TotalCount > len(pr.Assignees.Nodes) { if pr.Assignees.TotalCount > len(pr.Assignees.Nodes) {
list += ", …" list += ", …"
} }
return list return list
} }
func prLabelList(pr api.PullRequest) string { func prLabelList(pr api.PullRequest, cs *iostreams.ColorScheme) string {
if len(pr.Labels.Nodes) == 0 { if len(pr.Labels.Nodes) == 0 {
return "" return ""
} }
labelNames := make([]string, 0, len(pr.Labels.Nodes)) labelNames := make([]string, 0, len(pr.Labels.Nodes))
for _, label := range pr.Labels.Nodes { for _, label := range pr.Labels.Nodes {
labelNames = append(labelNames, label.Name) labelNames = append(labelNames, cs.HexToRGB(label.Color, label.Na me))
} }
list := strings.Join(labelNames, ", ") list := strings.Join(labelNames, ", ")
if pr.Labels.TotalCount > len(pr.Labels.Nodes) { if pr.Labels.TotalCount > len(pr.Labels.Nodes) {
list += ", …" list += ", …"
} }
return list return list
} }
func prProjectList(pr api.PullRequest) string { func prProjectList(pr api.PullRequest) string {
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)