提交 b207e803 编写于 作者: M Matthieu Antoine 提交者: Mislav Marohnić

Implement opening draft pull requests

Implement draft by adding a -d / --draft argument. Add setting header on
the API client for the moment as the feature is still in preview on the API
上级 13f29148
......@@ -16,7 +16,7 @@ import (
var cmdPullRequest = &Command{
Run: pullRequest,
Usage: `
pull-request [-focp] [-b <BASE>] [-h <HEAD>] [-r <REVIEWERS> ] [-a <ASSIGNEES>] [-M <MILESTONE>] [-l <LABELS>]
pull-request [-focp] [-b <BASE>] [-h <HEAD>] [-r <REVIEWERS> ] [-a <ASSIGNEES>] [-M <MILESTONE>] [-l <LABELS>] [--draft]
pull-request -m <MESSAGE> [--edit]
pull-request -F <FILE> [--edit]
pull-request -i <ISSUE>
......@@ -86,6 +86,9 @@ pull-request -i <ISSUE>
-l, --labels <LABELS>
Add a comma-separated list of labels to this pull request. Labels will be
created if they do not already exist.
-d, --draft
Create the pull request as a draft.
## Examples:
$ hub pull-request
......@@ -309,6 +312,8 @@ of text is the title and the rest is the description.`, fullBase, fullHead))
}
}
draft := args.Flag.Bool("--draft")
var pullRequestURL string
if args.Noop {
args.Before(fmt.Sprintf("Would request a pull request to %s from %s", fullBase, fullHead), "")
......@@ -319,6 +324,8 @@ of text is the title and the rest is the description.`, fullBase, fullHead))
"head": fullHead,
}
params["draft"] = draft
if title != "" {
params["title"] = title
if body != "" {
......
......@@ -409,6 +409,7 @@ func (c *simpleClient) jsonRequest(method, path string, body interface{}, config
return c.performRequest(method, path, buf, func(req *http.Request) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.Header.Set("Accept", "application/vnd.github.shadow-cat-preview")
if configure != nil {
configure(req)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册