Skip to content

Commit f1ea794

Browse files
author
Nate Smith
authored
Merge pull request cli#1580 from dan1elhughes/feature/number-url-scriptable-output
Number and URL included in scriptable output
2 parents 727b726 + 7b8d052 commit f1ea794

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/cmd/pr/view/view.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
4848
4949
Without an argument, the pull request that belongs to the current branch
5050
is displayed.
51-
51+
5252
With '--web', open the pull request in a web browser instead.
5353
`),
5454
Args: cobra.MaximumNArgs(1),
@@ -114,6 +114,8 @@ func printRawPrPreview(out io.Writer, pr *api.PullRequest) error {
114114
fmt.Fprintf(out, "reviewers:\t%s\n", reviewers)
115115
fmt.Fprintf(out, "projects:\t%s\n", projects)
116116
fmt.Fprintf(out, "milestone:\t%s\n", pr.Milestone.Title)
117+
fmt.Fprintf(out, "number:\t%d\n", pr.Number)
118+
fmt.Fprintf(out, "url:\t%s\n", pr.URL)
117119

118120
fmt.Fprintln(out, "--")
119121
fmt.Fprintln(out, pr.Body)

pkg/cmd/pr/view/view_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
9797
`reviewers:\t\n`,
9898
`projects:\t\n`,
9999
`milestone:\t\n`,
100+
`url:\thttps://github.com/OWNER/REPO/pull/12\n`,
101+
`number:\t12\n`,
100102
`blueberries taste good`,
101103
},
102104
},

0 commit comments

Comments
 (0)