Merge pull request #1580 from dan1elhughes/feature/number-url-scriptable-output

Number and URL included in scriptable output
This commit is contained in:
Nate Smith 2020-08-26 16:41:53 -05:00 committed by GitHub
commit f1ea794bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -48,7 +48,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
Without an argument, the pull request that belongs to the current branch
is displayed.
With '--web', open the pull request in a web browser instead.
`),
Args: cobra.MaximumNArgs(1),
@ -114,6 +114,8 @@ func printRawPrPreview(out io.Writer, pr *api.PullRequest) error {
fmt.Fprintf(out, "reviewers:\t%s\n", reviewers)
fmt.Fprintf(out, "projects:\t%s\n", projects)
fmt.Fprintf(out, "milestone:\t%s\n", pr.Milestone.Title)
fmt.Fprintf(out, "number:\t%d\n", pr.Number)
fmt.Fprintf(out, "url:\t%s\n", pr.URL)
fmt.Fprintln(out, "--")
fmt.Fprintln(out, pr.Body)

View file

@ -97,6 +97,8 @@ func TestPRView_Preview_nontty(t *testing.T) {
`reviewers:\t\n`,
`projects:\t\n`,
`milestone:\t\n`,
`url:\thttps://github.com/OWNER/REPO/pull/12\n`,
`number:\t12\n`,
`blueberries taste good`,
},
},