aboutsummaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-31 16:43:43 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-31 16:44:23 +0200
commit87669e0f18f282854d340a676834b939e34e5ed3 (patch)
treec78eaa155d2939d6647ab814c6710d0d3ed69a6e /input
parenteb39c5c29bc0e9b5e15a940a1b71bdac688b6535 (diff)
downloadgit-bug-87669e0f18f282854d340a676834b939e34e5ed3.tar.gz
termui: use the editor to create a new bug
Diffstat (limited to 'input')
-rw-r--r--input/input.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/input/input.go b/input/input.go
index 49d3501d..a1a2e885 100644
--- a/input/input.go
+++ b/input/input.go
@@ -14,6 +14,8 @@ import (
"strings"
)
+const messageFilename = "BUG_MESSAGE_EDITMSG"
+
var ErrEmptyMessage = errors.New("empty message")
var ErrEmptyTitle = errors.New("empty title")
@@ -24,14 +26,14 @@ const bugTitleCommentTemplate = `%s%s
# An empty title aborts the operation.
`
-func BugCreateEditorInput(repo repository.Repo, fileName string, preTitle string, preMessage string) (string, string, error) {
+func BugCreateEditorInput(repo repository.Repo, preTitle string, preMessage string) (string, string, error) {
if preMessage != "" {
preMessage = "\n\n" + preMessage
}
template := fmt.Sprintf(bugTitleCommentTemplate, preTitle, preMessage)
- raw, err := LaunchEditorWithTemplate(repo, fileName, template)
+ raw, err := LaunchEditorWithTemplate(repo, messageFilename, template)
if err != nil {
return "", "", err
@@ -73,8 +75,8 @@ const bugCommentTemplate = `
# and an empty message aborts the operation.
`
-func BugCommentEditorInput(repo repository.Repo, fileName string) (string, error) {
- raw, err := LaunchEditorWithTemplate(repo, fileName, bugCommentTemplate)
+func BugCommentEditorInput(repo repository.Repo) (string, error) {
+ raw, err := LaunchEditorWithTemplate(repo, messageFilename, bugCommentTemplate)
if err != nil {
return "", err