aboutsummaryrefslogtreecommitdiffstats
path: root/commands/comment.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-31 15:18:09 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-31 16:44:23 +0200
commiteb39c5c29bc0e9b5e15a940a1b71bdac688b6535 (patch)
tree5ef9b827f4a3097e4eb1367097d0059f895befbe /commands/comment.go
parent8a4e373e7b1c093abeb967d9a6a43c5ed533edb8 (diff)
downloadgit-bug-eb39c5c29bc0e9b5e15a940a1b71bdac688b6535.tar.gz
cli: rework new and comment command to better use the editor
a nice templace is now provided with explanations new: title and message can now be provided from the editor. Title will be the first non-empty line
Diffstat (limited to 'commands/comment.go')
-rw-r--r--commands/comment.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/commands/comment.go b/commands/comment.go
index ebbeaa77..cebf729c 100644
--- a/commands/comment.go
+++ b/commands/comment.go
@@ -2,9 +2,10 @@ package commands
import (
"errors"
+ "fmt"
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/bug/operations"
- "github.com/MichaelMure/git-bug/commands/input"
+ "github.com/MichaelMure/git-bug/input"
"github.com/spf13/cobra"
)
@@ -32,8 +33,13 @@ func runComment(cmd *cobra.Command, args []string) error {
return err
}
}
- if commentMessageFile == "" && commentMessage == "" {
- commentMessage, err = input.LaunchEditor(repo, messageFilename)
+
+ if commentMessage == "" {
+ commentMessage, err = input.BugCommentEditorInput(repo, messageFilename)
+ if err == input.ErrEmptyMessage {
+ fmt.Println("Empty message, aborting.")
+ return nil
+ }
if err != nil {
return err
}