提交 e8559dc2 编写于 作者: J Jingwen Owen Ou

Remove messageFile after done

上级 3e214787
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
var cmdPullRequest = &Command{ var cmdPullRequest = &Command{
Run: pullRequest, Run: pullRequest,
Usage: "pull-request [-f] [-i ISSUE] [-b BASE] [-d HEAD] [TITLE]", Usage: "pull-request [-f] [-i ISSUE] [-b BASE] [-d HEAD] [TITLE]",
Short: "Open a pull request on GitHub", Short: "Open a pull request on GitHub",
Long: `Opens a pull request on GitHub for the project that the "origin" remote Long: `Opens a pull request on GitHub for the project that the "origin" remote
points to. The default head of the pull request is the current branch. points to. The default head of the pull request is the current branch.
...@@ -55,6 +55,8 @@ func pullRequest(cmd *Command, args *Args) { ...@@ -55,6 +55,8 @@ func pullRequest(cmd *Command, args *Args) {
messageFile, err := git.PullReqMsgFile() messageFile, err := git.PullReqMsgFile()
utils.Check(err) utils.Check(err)
defer removeFile(messageFile)
err = writePullRequestChanges(repo, messageFile) err = writePullRequestChanges(repo, messageFile)
utils.Check(err) utils.Check(err)
...@@ -180,3 +182,8 @@ func readln(r *bufio.Reader) (string, error) { ...@@ -180,3 +182,8 @@ func readln(r *bufio.Reader) (string, error) {
return string(ln), err return string(ln), err
} }
func removeFile(file string) {
err := os.Remove(file)
utils.Check(err)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册