aboutsummaryrefslogtreecommitdiffstats
path: root/commands/add.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-10-17 21:42:13 +0200
committerMichael Muré <batolettre@gmail.com>2018-10-17 21:42:13 +0200
commitd37ffa6bd49f6f39a4de03dc2fa101832a1befe8 (patch)
treeec2a2b1f261eed43d3ace51e5ba4d806189539b9 /commands/add.go
parentf67c57c08407b935c82b8f47d36823725351efe0 (diff)
downloadgit-bug-d37ffa6bd49f6f39a4de03dc2fa101832a1befe8.tar.gz
commands: unify the processing from editor/file/stdin for "add" and "comment add"
fix #68
Diffstat (limited to 'commands/add.go')
-rw-r--r--commands/add.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/add.go b/commands/add.go
index 081c99f1..ecc2381e 100644
--- a/commands/add.go
+++ b/commands/add.go
@@ -17,20 +17,20 @@ var (
func runAddBug(cmd *cobra.Command, args []string) error {
var err error
- if addMessageFile != "" && addMessage == "" {
- addMessage, err = input.FromFile(addMessageFile)
- if err != nil {
- return err
- }
- }
-
backend, err := cache.NewRepoCache(repo)
if err != nil {
return err
}
defer backend.Close()
- if addMessage == "" || addTitle == "" {
+ if addMessageFile != "" && addMessage == "" {
+ addTitle, addMessage, err = input.BugCreateFileInput(addMessageFile)
+ if err != nil {
+ return err
+ }
+ }
+
+ if addMessageFile == "" && (addMessage == "" || addTitle == "") {
addTitle, addMessage, err = input.BugCreateEditorInput(backend, addTitle, addMessage)
if err == input.ErrEmptyTitle {