Merge pull request #3741 from jack1142/patch-1
Include issue number alongside the title in `gh issue/pr view`
This commit is contained in:
commit
a1cedfcd5c
4 changed files with 22 additions and 16 deletions
|
|
@ -160,6 +160,7 @@ func printRawIssuePreview(out io.Writer, issue *api.Issue) error {
|
|||
milestoneTitle = issue.Milestone.Title
|
||||
}
|
||||
fmt.Fprintf(out, "milestone:\t%s\n", milestoneTitle)
|
||||
fmt.Fprintf(out, "number:\t%d\n", issue.Number)
|
||||
fmt.Fprintln(out, "--")
|
||||
fmt.Fprintln(out, issue.Body)
|
||||
return nil
|
||||
|
|
@ -172,7 +173,7 @@ func printHumanIssuePreview(opts *ViewOptions, issue *api.Issue) error {
|
|||
cs := opts.IO.ColorScheme()
|
||||
|
||||
// Header (Title and State)
|
||||
fmt.Fprintln(out, cs.Bold(issue.Title))
|
||||
fmt.Fprintf(out, "%s #%d\n", cs.Bold(issue.Title), issue.Number)
|
||||
fmt.Fprintf(out,
|
||||
"%s • %s opened %s • %s\n",
|
||||
issueStateTitleWithColor(cs, issue.State),
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ func TestIssueView_nontty_Preview(t *testing.T) {
|
|||
`comments:\t9`,
|
||||
`author:\tmarseilles`,
|
||||
`assignees:`,
|
||||
`number:\t123\n`,
|
||||
`\*\*bold story\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -126,6 +127,7 @@ func TestIssueView_nontty_Preview(t *testing.T) {
|
|||
`labels:\tone, two, three, four, five`,
|
||||
`projects:\tProject 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`,
|
||||
`milestone:\tuluru\n`,
|
||||
`number:\t123\n`,
|
||||
`\*\*bold story\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -136,6 +138,7 @@ func TestIssueView_nontty_Preview(t *testing.T) {
|
|||
`state:\tOPEN`,
|
||||
`author:\tmarseilles`,
|
||||
`labels:\ttarot`,
|
||||
`number:\t123\n`,
|
||||
},
|
||||
},
|
||||
"Closed issue": {
|
||||
|
|
@ -146,6 +149,7 @@ func TestIssueView_nontty_Preview(t *testing.T) {
|
|||
`\*\*bold story\*\*`,
|
||||
`author:\tmarseilles`,
|
||||
`labels:\ttarot`,
|
||||
`number:\t123\n`,
|
||||
`\*\*bold story\*\*`,
|
||||
},
|
||||
},
|
||||
|
|
@ -178,7 +182,7 @@ func TestIssueView_tty_Preview(t *testing.T) {
|
|||
"Open issue without metadata": {
|
||||
fixture: "./fixtures/issueView_preview.json",
|
||||
expectedOutputs: []string{
|
||||
`ix of coins`,
|
||||
`ix of coins #123`,
|
||||
`Open.*marseilles opened about 9 years ago.*9 comments`,
|
||||
`bold story`,
|
||||
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
|
||||
|
|
@ -187,7 +191,7 @@ func TestIssueView_tty_Preview(t *testing.T) {
|
|||
"Open issue with metadata": {
|
||||
fixture: "./fixtures/issueView_previewWithMetadata.json",
|
||||
expectedOutputs: []string{
|
||||
`ix of coins`,
|
||||
`ix of coins #123`,
|
||||
`Open.*marseilles opened about 9 years ago.*9 comments`,
|
||||
`8 \x{1f615} • 7 \x{1f440} • 6 \x{2764}\x{fe0f} • 5 \x{1f389} • 4 \x{1f604} • 3 \x{1f680} • 2 \x{1f44e} • 1 \x{1f44d}`,
|
||||
`Assignees:.*marseilles, monaco\n`,
|
||||
|
|
@ -201,7 +205,7 @@ func TestIssueView_tty_Preview(t *testing.T) {
|
|||
"Open issue with empty body": {
|
||||
fixture: "./fixtures/issueView_previewWithEmptyBody.json",
|
||||
expectedOutputs: []string{
|
||||
`ix of coins`,
|
||||
`ix of coins #123`,
|
||||
`Open.*marseilles opened about 9 years ago.*9 comments`,
|
||||
`No description provided`,
|
||||
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
|
||||
|
|
@ -210,7 +214,7 @@ func TestIssueView_tty_Preview(t *testing.T) {
|
|||
"Closed issue": {
|
||||
fixture: "./fixtures/issueView_previewClosedState.json",
|
||||
expectedOutputs: []string{
|
||||
`ix of coins`,
|
||||
`ix of coins #123`,
|
||||
`Closed.*marseilles opened about 9 years ago.*9 comments`,
|
||||
`bold story`,
|
||||
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
|
||||
|
|
@ -310,7 +314,7 @@ func TestIssueView_tty_Comments(t *testing.T) {
|
|||
"IssueByNumber": "./fixtures/issueView_previewSingleComment.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`some title`,
|
||||
`some title #123`,
|
||||
`some body`,
|
||||
`———————— Not showing 5 comments ————————`,
|
||||
`marseilles \(Collaborator\) • Jan 1, 2020 • Newest comment`,
|
||||
|
|
@ -326,7 +330,7 @@ func TestIssueView_tty_Comments(t *testing.T) {
|
|||
"CommentsForIssue": "./fixtures/issueView_previewFullComments.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`some title`,
|
||||
`some title #123`,
|
||||
`some body`,
|
||||
`monalisa • Jan 1, 2020 • Edited`,
|
||||
`1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f} • 4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680} • 7 \x{1f44e} • 8 \x{1f44d}`,
|
||||
|
|
@ -386,6 +390,7 @@ func TestIssueView_nontty_Comments(t *testing.T) {
|
|||
`state:\tOPEN`,
|
||||
`author:\tmarseilles`,
|
||||
`comments:\t6`,
|
||||
`number:\t123`,
|
||||
`some body`,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ func printHumanPrPreview(opts *ViewOptions, pr *api.PullRequest) error {
|
|||
cs := opts.IO.ColorScheme()
|
||||
|
||||
// Header (Title and State)
|
||||
fmt.Fprintln(out, cs.Bold(pr.Title))
|
||||
fmt.Fprintf(out, "%s #%d\n", cs.Bold(pr.Title), pr.Number)
|
||||
fmt.Fprintf(out,
|
||||
"%s • %s wants to merge %s into %s from %s • %s %s \n",
|
||||
shared.StateTitleWithColor(cs, *pr),
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"PullRequestByNumber": "./fixtures/prViewPreview.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
|
|
@ -363,7 +363,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"PullRequestByNumber": "./fixtures/prViewPreviewWithMetadataByNumber.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`Reviewers:.*1 \(.*Requested.*\)\n`,
|
||||
`Assignees:.*marseilles, monaco\n`,
|
||||
|
|
@ -382,7 +382,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"ReviewsForPullRequest": "./fixtures/prViewPreviewManyReviews.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Reviewers: DEF \(Commented\), def \(Changes requested\), ghost \(Approved\), hubot \(Commented\), xyz \(Approved\), 123 \(Requested\), abc \(Requested\), my-org\/team-1 \(Requested\)`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
|
|
@ -395,7 +395,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"PullRequestByNumber": "./fixtures/prViewPreviewClosedState.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Closed.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
|
|
@ -408,7 +408,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"PullRequestByNumber": "./fixtures/prViewPreviewMergedState.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Merged.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
|
|
@ -421,7 +421,7 @@ func TestPRView_Preview(t *testing.T) {
|
|||
"PullRequestByNumber": "./fixtures/prViewPreviewDraftState.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`Blueberries are from a fork`,
|
||||
`Blueberries are from a fork #12`,
|
||||
`Draft.*nobody wants to merge 12 commits into master from blueberries.+100.-10`,
|
||||
`blueberries taste good`,
|
||||
`View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
|
||||
|
|
@ -501,7 +501,7 @@ func TestPRView_tty_Comments(t *testing.T) {
|
|||
"ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`some title`,
|
||||
`some title #12`,
|
||||
`1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f}`,
|
||||
`some body`,
|
||||
`———————— Not showing 9 comments ————————`,
|
||||
|
|
@ -521,7 +521,7 @@ func TestPRView_tty_Comments(t *testing.T) {
|
|||
"CommentsForPullRequest": "./fixtures/prViewPreviewFullComments.json",
|
||||
},
|
||||
expectedOutputs: []string{
|
||||
`some title`,
|
||||
`some title #12`,
|
||||
`some body`,
|
||||
`monalisa • Jan 1, 2020 • Edited`,
|
||||
`1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f} • 4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680} • 7 \x{1f44e} • 8 \x{1f44d}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue